[issue35305] subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=PIPE) itself hangs/deadlocks (Linux)

2018-12-04 Thread INADA Naoki


INADA Naoki  added the comment:

>
> where the *child* process (`self.pid == 0`) get stuck while calling 
> _dup2(c2pwrite = 4, 1) which in turn calls os.dup2(a = 4, b = 1).
>

Doesn't child process get stuck while writing stdout?

>
> It would also be interesting to understand exactly what causes the stall.  Is 
> it indeed the pipe that gets filled up?  Is that because the kernel does 
> *not* respect the pipe limit and just dumps all output at once (> 65,536 
> bytes), i.e. it is a bug?  Or is it that Python or one of its dependencies 
> runs into a race condition because, say, it does not have a chance to set up 
> the parent-child communication before the child (== the kernel) dumps too 
> much data?
>

In a normal case, when child process succeeded to `exec`,
`errpipe_write` must be closed, by CLOEXEC flag.
Then, parent process `_eintr_retry_call(os.read, errpipe_read,
1048576)` returns b"".
So parent process can read from stdio pipes, and child process can
write to stdio pipes more than 65536 bytes.

In your case, `errpipe_write` is not closed when `exec` is succeeded.
That's kernel bug.
Parent process `_eintr_retry_call(os.read, errpipe_read, 1048576)`
does not return until child process exits.
But child process is blocked when writing to stdout/err more than 65536 bytes.
Deadlock happened.

>
> A BROKEN DESIGN?
>
> Finally, I don't know if the fact that `/sbin/ldconfig` does not exist but 
> you can yet call it is (i) poorly designed kernel, or (ii) a valid design in 
> the Unix world.  I don't know the answer to this and I don't claim one is 
> more correct than the other.  I also don't know if there are other kernels 
> out there that does this type of interception.  If it is indeed a valid 
> design, then one could argue that Python and other software tools should be 
> able to handle it.  FYI, this far I've/we've only hit this issue with Python 
> (>= 2.7.13), maybe because of pure luck.  It did not cause a problem in 
> Python (< 2.7.13) and it does not cause a problem if we use 
> subprocess.Popen(..., 'shell = True').  On the other hand, if one would argue 
> that it is a poor design, then would it make sense to protect against by for 
> instance asserting that the executable actually exists before calling it:
>

I don't know (i) or (II).
But I don't think the assertion makes sense.  I expect OSError rather
than RuntimeError.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35403] support application/wasm in mimetypes and http.server

2018-12-04 Thread pmpp


New submission from pmpp :

web browsers have recently gained ability to run webassembly code and for that 
a new content type has to be add to web servers for optimal use:

wasm => Content-Type header : application/wasm

spec says it :
https://webassembly.github.io/spec/web-api/index.html#streaming-modules

"Firefox streaming compilation needs Content-Type header set"

cf: https://groups.google.com/forum/#!topic/emscripten-discuss/C7-i1gqWay4

google's filament documentation says:
"Python's simple server [...] does not serve WebAssembly files with the correct 
MIME type."

it would be logical since simple htt server is mostly used for testing software 
to offer support of that new techonology.

--
messages: 331015
nosy: pmpp
priority: normal
severity: normal
status: open
title: support application/wasm in mimetypes and http.server
type: enhancement
versions: Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35403] support application/wasm in mimetypes and http.server

2018-12-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Python 3.7 is in feature-freeze, so any new features like this will have to be 
3.8 only.

--
nosy: +steven.daprano
versions:  -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35365] Use wchar_t* buffer instead of Unicode object in code page decoder

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset eeb719eac6347f5b6e85389aa13a386024766806 by Serhiy Storchaka in 
branch 'master':
bpo-35365: Use a wchar_t* buffer in the code page decoder. (GH-10837)
https://github.com/python/cpython/commit/eeb719eac6347f5b6e85389aa13a386024766806


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35243] readline timeout too long for async gfx use

2018-12-04 Thread pmpp


Change by pmpp :


--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35404] Document how to import _structure in email.message

2018-12-04 Thread Charles-Axel Dein


New submission from Charles-Axel Dein :

The example for `walk()` in `email.message.EmailMessage` makes use of the 
`_structure` function but does not clarify how to import it.

I can make a patch adding a line:

  from email.iterators import _structure

--
assignee: docs@python
components: Documentation
messages: 331018
nosy: charlax, docs@python
priority: normal
severity: normal
status: open
title: Document how to import _structure in email.message
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35404] Document how to import _structure in email.message

2018-12-04 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +10124
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers


Chris Withers  added the comment:


New changeset e63e617ebbe481c498bdf037a62e09f4f9f3963f by Chris Withers (Andrew 
Dunai) in branch 'master':
bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of 
_Call/_MagicProxy. (#10873)
https://github.com/python/cpython/commit/e63e617ebbe481c498bdf037a62e09f4f9f3963f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10125

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10126

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35395] Typo in asyncio eventloop documentation

2018-12-04 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thanks Naglis

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers


Chris Withers  added the comment:


New changeset 12735c14134082584b899308af8dd8fcc9f15696 by Chris Withers (Miss 
Islington (bot)) in branch '3.7':
bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of 
_Call/_MagicProxy. (GH-10873) (#10887)
https://github.com/python/cpython/commit/12735c14134082584b899308af8dd8fcc9f15696


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers


Change by Chris Withers :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35357] unittest.mock.call can't represent calls to a method called 'parent'

2018-12-04 Thread Chris Withers


Chris Withers  added the comment:


New changeset 70ca3fce9fe2bdd7bf97d5fe1299cfa5e32b3ad4 by Chris Withers (Miss 
Islington (bot)) in branch '3.6':
bpo-35357: Add _mock_ prefix to name/parent/from_kall attributes of 
_Call/_MagicProxy. (GH-10873)
https://github.com/python/cpython/commit/70ca3fce9fe2bdd7bf97d5fe1299cfa5e32b3ad4


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35379] IDLE's close fails when io.filename set to None

2018-12-04 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Serhiy, this issue appears to be about an exception raised when an IDLE editor 
shutdown is called twice. Any thoughts would be appreciated. 

The recent #35263 and old #17822 are also intermittant unsolved None attribute 
errors.  #17614 (spunoff from *17613) fixed an instance of this exact error.  
#22614 fixed a related error. 

For an editor, io is unconditionally set and unset in __init__ and _close with
 249: self.io = io = self.IOBinding(self) # from iomenu.py
1026: self.io = None
The reset to None is after the failing self.io.filename test, so it seems that 
failure is not possible.  There is no other occurrence of re 'io\s=\sNone' in 
idlelib.

There are, however, 3 explicit explicit tests of self.io.

1. editor.py, 1005-6, David Scherer in 2009, no issue or commit message.
def maybesave(self):
if self.io:  # should add '== None' here and 'return None' at end.
Called by close() before _close().


2. pyshell.py, Roger Serwy, #17614, 265-270
def restore_file_breaks(self):  # part of editor initialization
self.text.update()   # this enables setting "BREAK" tags to be visible
if self.io is None:
# can happen if IDLE closes due to the .update() call
return
Triggered by editing a large file and hitting Alt-F4 after the editor window 
appears but before initialization is complete.  (Should add issue to comment.)

3. pyshell.py, Serhiy Storchaka, 154-8
def color_breakpoint_text(self, color=True):
"Turn colorizing of breakpoint text on or off"
if self.io is None:
# possible due to update in restore_file_breaks
return

The latter two are a race condition of close being called by an event handler 
while initialization is ongoing.  This does not obviously apply to maybesave or 
this issue, but maybe somehow close can be called again while still executing.

The failing line is followed by
self.update_recent_files_list(new_file=self.io.filename)
If there is no io, this cannot execute, and the test might be changed to
 if self.io in not None and self.io.filename:
However, self.io.close() would then fail.  Even with that fixed, I imagine that 
other shutdown  calls in _close() could fail.  If 'self.per = None' or 
'self.top.destroy() are called once, a subsequent self.per or self.top will 
fail.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25862] TextIOWrapper assertion failure after read() and SEEK_CUR

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset eab421bff954e4fb77516bfe6c98d30ced1412d0 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-25862: Fix several bugs in the _io module. (GH-8026) (GH-8033)
https://github.com/python/cpython/commit/eab421bff954e4fb77516bfe6c98d30ced1412d0


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35405] Wrong traceback for AssertionError while running under pdb

2018-12-04 Thread Karthikeyan Singaravelan

New submission from Karthikeyan Singaravelan :

While running under pdb when I have an assertion error after the command 
continue then  the assertion error is mentioned with the statement under which 
I have executed continue command in pdb. Below script has an assertion error on 
assert 1 == 2 but when I execute continue from assert 1 == 1 then it shows the 
line assert 1 == 1 with the AssertionError. I first noticed this with unittest 
but seems to be a general issue with assert. This is confusing while debugging 
unittest failures. 

I searched for issues but couldn't find a related one and this exists on master 
and 2.7. I assume this is a case where AssertionError doesn't use the current 
line and uses the one where pdb is executed with continue? I don't know if this 
is an issue with pdb or assert so I am adding Library as the component.

# Reproducible script

import pdb; pdb.set_trace();

assert 1 == 1

for i in range(10):
pass

assert 1 == 2

# Executing on master

➜  cpython git:(master) $ ./python.exe /tmp/foo.py
> /tmp/foo.py(3)()
-> assert 1 == 1
(Pdb) c
Traceback (most recent call last):
  File "/tmp/foo.py", line 3, in 
assert 1 == 1
AssertionError

--
components: Library (Lib)
messages: 331025
nosy: xtreak
priority: normal
severity: normal
status: open
title: Wrong traceback for AssertionError while running under pdb
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35394] Add __slots__ = () to asyncio protocols

2018-12-04 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
keywords: +patch
pull_requests: +10127
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> that there is code in the stdlib that holdes reference between child and 
> parent

Just to clarify: is not that is just code in the stdlib that keeps a reference 
between child and parent. The examples I have given are the exact same 
situation that we have here: the iterator object associated with another needs 
to keep its parent alive to work correctly.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35305] subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=PIPE) itself hangs/deadlocks (Linux)

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

I tested:

* Python 2.6.6 (installed from RHEL) on RHEL6
* Python 2.7.15 (compiled manually) on RHEL6
* Python 2.7.15 (installed from Fedora) on Fedora 29

Note: I tested RHEL 6.10 with kernel 2.6.32-754.el6.x86_64.

The fact that Python 3 is also impacted makes me think that it's a bug in your 
kernel, not in Python.


"MY CONCLUSION: To me, this looks like a deadlock in Popen() itself - is that 
correct?"

It works on all systems except of yours, I don't think that it's a bug in 
Python.

You have to debug your kernel.

This issue is not a Python bug, so I close it.

If you are a Red Hat customer, contact Red Hat to get support.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16865] ctypes arrays >=2GB in length causes exception

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 93d7918f77278f973a4a106c1d01ad2d9805816d by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-16865: Support arrays >=2GB in ctypes. (GH-3006). (GH-7441)
https://github.com/python/cpython/commit/93d7918f77278f973a4a106c1d01ad2d9805816d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16865] ctypes arrays >=2GB in length causes exception

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> The environment is Windows 8 Pro 64-bit running Python 64-bit in the 
> WinPython distribution.

This issue is specific to system with 32-bit long but 64-bit void* I guess? So 
only Windows is impacted?

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16865] ctypes arrays >=2GB in length causes exception

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This issue is specific to system with 32-bit long but 64-bit size_t. Yes, seems 
the only supported impacted system is Windows.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25862] TextIOWrapper assertion failure after read() and SEEK_CUR

2018-12-04 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin

New submission from Şahin :

import calendar
calendar.nextmonth(2018, 11) returns (2018, 12) which is OK.
calendar.nextmonth(2018, 12) returns (2019, 1) which is also OK.
calendar.nextmonth(2018, 13) returns (2018, 14). It would make more sense if 
this was raise calendar.IllegalMonthError.

--
components: Library (Lib)
messages: 331031
nosy: asocia
priority: normal
severity: normal
status: open
title: calendar.nextmonth and calendar.prevmonth functions doesn't check if the 
month is valid

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin

Change by Şahin :


--
keywords: +patch
pull_requests: +10128
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

prevmonth() and nextmonth() are internal functions. They are used only in 
itermonthdays3(), and the month is already checked before calling them.

--
nosy: +belopolsky, rhettinger, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35405] Wrong traceback for AssertionError while running under pdb

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is nothing specific for assert and AssertionError. Other example:

import pdb; pdb.set_trace()
x = 1
y = 1/0

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35365] Use wchar_t* buffer instead of Unicode object in code page decoder

2018-12-04 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin

Şahin  added the comment:

I understand you but i still think these functions need to check it. As an 
end-user, I shouldn't see these functions to work with no errors for illegal 
months.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35389] Use gnu_get_libc_version() in platform.libc_ver()?

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +10130
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35389] Use gnu_get_libc_version() in platform.libc_ver()?

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Currently libc_ver() can be used for other executable. See issue26544 for 
discussion about libc_ver().

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is the problem with current code? Can you provide an example that doesn't 
work correctly?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35407] Datetime function with selenium

2018-12-04 Thread Sameer Joshi


New submission from Sameer Joshi :

I have defined 2 variables , 1 for Friday and other for rest of weekdays. 
However when I match these two with the website date(which is 'today - 3' for 
Monday and 'today -1' )it shows the error as variable not defined. Below is 
code for the same.

import datetime


d = datetime.date.today()

if d.weekday() == 0:
tdelta = datetime.timedelta(days=3)
friday = d - tdelta
print(friday)


elif d.weekday() in range(1,5):
tdelta1 = datetime.timedelta(days=1)
prev_day = d - tdelta1
print(prev_day)

data_date = new.date()  # data_date is the date fetched from website
if data_date == friday:
print("Data as on", friday, "for Race Horses")
elif data_date == prev_day:
print("Data as on", prev_day, "for Race Horses")
else:
print("Data update required.")

--
messages: 331038
nosy: jsameer23
priority: normal
severity: normal
status: open
title: Datetime function with selenium
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35407] Datetime function with selenium

2018-12-04 Thread Sameer Joshi


Sameer Joshi  added the comment:

I have defined 2 variables , 1 for Friday and other for rest of weekdays. 
However when I match these two with the website date(which is 'today - 3' for 
Monday and 'today -1' )it shows the error as variable not defined. Below is 
code for the same.

import datetime


d = datetime.date.today()

if d.weekday() == 0:
tdelta = datetime.timedelta(days=3)
friday = d - tdelta
print(friday)


elif d.weekday() in range(1,5):
tdelta1 = datetime.timedelta(days=1)
prev_day = d - tdelta1
print(prev_day)

data_date = new.date()  # data_date is the date fetched from website
if data_date == friday:
print("Data as on", friday, "for page")
elif data_date == prev_day:
print("Data as on", prev_day, "for page")
else:
print("Data update required.")

--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35408] Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK

2018-12-04 Thread Enric Tejedor Saavedra


New submission from Enric Tejedor Saavedra :

Attached is a reproducer that calls PyCFunction_New. The reproducer runs 
normally with Python 3.6.5, but it crashes with Python 3.7.1. The reason seems 
to be that the _PyObject_GC_TRACK macro ends up being called and it is broken 
in Python3.7.

A fix for that macro seems to have been committed to master:

https://github.com/python/cpython/pull/10507

--
components: Interpreter Core
files: reproducer.cpp
messages: 331040
nosy: etejedor
priority: normal
severity: normal
status: open
title: Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK
type: crash
versions: Python 3.7
Added file: https://bugs.python.org/file47971/reproducer.cpp

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35389] Use gnu_get_libc_version() in platform.libc_ver()?

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> Currently libc_ver() can be used for other executable. See issue26544 for 
> discussion about libc_ver().

Oh, my PR had a bug: it ignores executable. Fixed: it now only uses 
os.confstr() if the executable argument is not set.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin

Şahin  added the comment:

I'm suggesting this idea to consistency. Why an IllegalMonthError exists in 
calendar module if we don't raise this error when required?

What would you say if I asked you to "What is the month number coming after 
156th month?" Would you say 157 or prefer to inform me that I'm doing something 
wrong?

>>> import calendar
>>> calendar.nextmonth(2018, 12)
(2019, 1)

If Python is smart enough to jump next year's first month and not say (2018, 
13) blindly, it should also check if the given month is valid. 

But:
>>> calendar.nextmonth(2018, 157)
(2018, 158)

I think this is clearly a bug in the code.


---

I'll wander away from the this issue but some of the functions in calendar 
module also not consistent with each other:

>>> calendar.monthcalendar(2018, 12) # Runs with no problem.
>>> calendar.monthcalendar(2018, 0)  # Raises IllegalMonthError.
>>> calendar.monthcalendar(2018, 13) # Raises IllegalMonthError.

>>> calendar.month(2018, 12) # Runs with no problem.
>>> calendar.month(2018, 0)  # Raises IllegalMonthError.
>>> calendar.month(2018, 13) # Raises IndexError???

Why? Wouldn't it be more reasonable if the last one also had raised 
IllegalMonthError? 

>>> calendar.monthrange(2018, 12) # Runs with no problem.
>>> calendar.monthrange(2018, 0)  # Raises IllegalMonthError.
>>> calendar.monthrange(2018, 13) # Raises IllegalMonthError.

>>> calendar.prmonth(2018, 12) # Runs with no problem.
>>> calendar.prmonth(2018, 0)  # Raises IllegalMonthError.
>>> calendar.prmonth(2018, 13) # Raises IndexError.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2018-12-04 Thread Vincent Michel


New submission from Vincent Michel :

As far as I can tell, this issue is different than: 
https://bugs.python.org/issue34730

I noticed `async_gen.aclose()` raises a GeneratorExit exception if the async 
generator finalization awaits and silence a failing unfinished future (see 
example.py).

This seems to be related to a bug in `async_gen_athrow_throw`. In fact, 
`async_gen.aclose().throw(exc)` does not silence GeneratorExit exceptions. This 
behavior can be reproduced without asyncio (see test.py).

Attached is a possible patch, although I'm not too comfortable messing with the 
python C internals. I can make a PR if necessary.

--
components: Interpreter Core
files: example.py
messages: 331043
nosy: vxgmichel
priority: normal
severity: normal
status: open
title: Async generator might re-throw GeneratorExit on aclose()
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47972/example.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35407] Datetime function with selenium

2018-12-04 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is for reporting bugs in the Python interpreter and standard library, not 
for asking for help with bugs in your own code.

The code you show contains a syntax error (some of the indentation is wrong) 
and at least one undefined variable, "new". The traceback you got would have 
shown you that:

py> data_date = new.date()  # data_date is the date fetched from website
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'new' is not defined


You need to define "new" before you can use it. Since this is not a bug in 
Python, I'm closing this. If you disagree, please read this website:

http://sscce.org/

copy and paste the full exception you get, and be prepared to explain why it is 
a bug in the interpreter rather than in your code.

--
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2018-12-04 Thread Vincent Michel


Change by Vincent Michel :


Added file: https://bugs.python.org/file47973/test.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2018-12-04 Thread Vincent Michel


Change by Vincent Michel :


--
keywords: +patch
Added file: https://bugs.python.org/file47974/patch.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35405] Wrong traceback for AssertionError while running under pdb

2018-12-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Serhiy, is this a known behavior or issue since it's from 2.7 ? This is 
highly confusing and misleading as in your example and also while debugging 
tests that fail at a different line of assertion statement from the current 
line in pdb which might also be a different assert statement.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

nextmonth() is not a public API. You should not use it.

If you want to make IllegalMonthError be always raised instead of IndexError 
for out of range month values, this is a different issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35346] Modernize Lib/platform.py code

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10131

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35408] Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35408] Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

> Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK

It's unrelated. Your must not use the Python API before Python is initialized. 
If you modify your code like that, it works as expected:

int main()
{
Py_Initialize();

  PyMethodDef methoddef_ = {
const_cast< char* >( "myfun" ),
(PyCFunction) myfun,
METH_O,
NULL
  };

  PyObject* myFunPtr = PyCFunction_New( &methoddef_, NULL );

Py_Finalize();
  return 0;
}

I don't think that it's a regression.

Python initialization is now well documented:
https://docs.python.org/dev/c-api/init.html

The documentation starts with:

"In an application embedding Python, the Py_Initialize() function must be 
called before using any other Python/C API functions; with the exception of a 
few functions and the global configuration variables."

PyCFunction_New() is an example of function of the Python C API.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35408] Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

I close the issue as "not a bug".

Even if the code "worked" in Python 3.6, it worked because of a mistake :-)

--
nosy: +eric.snow, ncoghlan
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35351] LTOFLAGS are passed to BASECFLAGS when using LTO

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f92c7aa1ae81efa475b5aecf66e4711ef0f52c4c by Victor Stinner 
(stratakis) in branch 'master':
bpo-35351: Pass link time optimization flags to CFLAGS_NODIST (GH-10797)
https://github.com/python/cpython/commit/f92c7aa1ae81efa475b5aecf66e4711ef0f52c4c


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35351] LTOFLAGS are passed to BASECFLAGS when using LTO

2018-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10132

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread శ్రీనివాస్ రెడ్డి తాటిపర్తి

Srinivas  Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) 
 added the comment:

I agree with Serhiy, nextmonth() is not a public API,you should not use it.

--
nosy: +thatiparthy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35351] LTOFLAGS are passed to BASECFLAGS when using LTO

2018-12-04 Thread miss-islington


miss-islington  added the comment:


New changeset 1751423686d05e3facdd6da2620202728e5d7917 by Miss Islington (bot) 
in branch '3.7':
bpo-35351: Pass link time optimization flags to CFLAGS_NODIST (GH-10797)
https://github.com/python/cpython/commit/1751423686d05e3facdd6da2620202728e5d7917


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35376] modulefinder skips nested modules with same name as top-level bad module

2018-12-04 Thread rdb


Change by rdb :


--
pull_requests: +10133

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin

Şahin  added the comment:

OK now it isn't a problem if we shouldn't use this function directly but how am 
i going to understand if a function is public API or not? In classes, we are 
using single or double underscore to indicate that the function or variable 
we're declaring is intended to be private. Is there anything similar to this 
for "public API functions" or am I in the wrong way?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> On Dec 4, 2018, at 10:27 AM, Şahin  wrote:
> 
> Is there anything similar to this for "public API functions"?

Yes - read the reference manual. If the function is not there it is not public.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Paul Ganssle


Paul Ganssle  added the comment:

Might it be worth moving `nextmonth` and `prevmonth` to `calendar._nextmonth` 
and `calendar._prevmonth` to make it more clear that these are private methods?

Due to Hyrum's Law, people will be using them anyway, but it could have a short 
deprecation period where `calendar.nextmonth` and `calendar.prevmonth` raise 
DeprecationWarning and then call `calendar._nextmonth` and 
`calendar._prevmonth`.

--
nosy: +p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35376] modulefinder skips nested modules with same name as top-level bad module

2018-12-04 Thread rdb


Change by rdb :


--
pull_requests: +10134

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35376] modulefinder skips nested modules with same name as top-level bad module

2018-12-04 Thread rdb


Change by rdb :


--
pull_requests:  -10133

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +10136
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

Oh. That's just a variant of the old bpo-25234.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

2018-12-04 Thread Paul Ganssle


Paul Ganssle  added the comment:

This is another manifestation of issue 32417.

The biggest complication, to me, is that adding a `timedelta` to a datetime 
always returns a `datetime.datetime` rather than the subclass that it was added 
to.

I *think* most if not all people would consider this a bug, and we can probably 
fix it. That should cascade down to `fromutc` and then to `astimezone`.

--
nosy: +p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

They are not in the __all__ list and are not documented. If __all__ is defined 
for the module, there is no need to use the underscore prefix for private 
globals. The calendar module is not special, many other modules follow this 
convention.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is not easy problem, ant it doesn't have right solution. Different 
decisions were made for the result type of alternate constructors and operators 
for different classes.
 
The frombytes() method of an int subclass returns an int. As well arithmetic 
operations with int subclasses return an int.

The fromhex() method of a bytes subclass returns an instance of this subclass. 
But arithmetic operations with bytes subclasses return a bytes object.

The fromkeys() method of a dict subclass returns an instance of this subclass. 
The copy() method of a dict subclass returns a dict. The copy() method of a 
dict subclass returns a dict. But defaultdict, OrdertedDict and Counter 
redefine it: copy() methods of their subclasses return the object of the same 
type.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10138

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-04 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10139

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35296] Install Include/internal/ header files

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10137

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4752e65250bce60b97d5af702d586092d02fbf58 by Victor Stinner in 
branch 'master':
bpo-35363, test_eintr: skip test_open() on macOS (GH-10896)
https://github.com/python/cpython/commit/4752e65250bce60b97d5af702d586092d02fbf58


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35296] Install Include/internal/ header files

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue since I'm now also interested to make the change in Python 
3.7. I wrote PR 10897.

See discussion on python-dev:
https://mail.python.org/pipermail/python-dev/2018-December/155921.html

--
resolution: fixed -> 
status: closed -> open
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35346] Modernize Lib/platform.py code

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b8e689a6e8134e88f857a55e50b6a4977967e385 by Victor Stinner in 
branch 'master':
bpo-35346, platform: import subprocess in _syscmd_file() (GH-10892)
https://github.com/python/cpython/commit/b8e689a6e8134e88f857a55e50b6a4977967e385


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

2018-12-04 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Ping.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35405] Wrong traceback for AssertionError while running under pdb

2018-12-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems this is a known issue and has an open PR 
https://github.com/python/cpython/pull/6233 . I checked out the PR locally and 
it works fine on the examples presented though has merge conflicts with master. 
I am closing it as duplicate of issue16482 that links to other possible issues.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> pdb.set_trace() clobbering traceback on error

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35257] Add LDFLAGS_NODIST for the LDFLAGS not intended for propagation to C extensions.

2018-12-04 Thread Charalampos Stratakis


Change by Charalampos Stratakis :


--
keywords: +patch
pull_requests: +10140
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16482] pdb.set_trace() clobbering traceback on error

2018-12-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I too just hit this issue with pdb and checked out the PR locally. It works 
fine though it has merge conflicts with latest master. I am adding 3.8, 3.7 and 
3.6 removing the older versions that don't support bug fixes. Since the PR has 
unknown repository I suppose @xdegaye has deleted their fork and I don't know 
if the PR can be revived without opening a new one.

I have merged the latest master in my own fork resolving conflicts in case a 
new PR has to be generated : 
https://github.com/python/cpython/compare/master...tirkarthi:pr-6233-latest. 
Adding Serhiy to the issue. The PR also solves many linked issues in the PR and 
I thought to add the update here since it seemed appropriate.

Thanks much @xdegaye for the PR

--
nosy: +serhiy.storchaka, xtreak
versions: +Python 3.6, Python 3.7, Python 3.8 -Python 3.2, Python 3.3, Python 
3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5430] imaplib: must not replace LF or CR by CRLF in literals

2018-12-04 Thread Natal Ngétal

Change by Natal Ngétal :


--
pull_requests: +10141
stage: test needed -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

2018-12-04 Thread Paul Ganssle


Paul Ganssle  added the comment:

> This is not easy problem, ant it doesn't have right solution. Different 
> decisions were made for the result type of alternate constructors and 
> operators for different classes.

It's certainly true that it occasionally makes sense to do something like this, 
but this one is particularly egregious. Because of an implementation detail of 
`fromtimestamp` (and `now`, and a few others), which is actually relying on an 
implementation detail of `fromutc`, which is actually relying on what *may* 
have been a choice in the `__add__` method of timedelta, you get a *different 
class* in the alternate constructor of a subclass depending on the *argument* 
to the alternate constructor. This is pretty solidly a bug.

I think the things we need to take into account are:

1. What do we consider the contract of the relevant functions involved
2. What do people expect the code to do?
3. Is it likely that anyone is *relying* on the existing behavior.


The most fundamental problem, timedelta addition, is also the closest call, so 
I think we should *start* with the analysis there.

For #1, the contract is either "x + timedelta returns a datetime if x is a 
datetime subclass" or "x + timedelta returns a datetime or datetime subclass" - 
both of these are consistent with the current behavior, and as long as 
"datetime subclass isa datetime", I don't see that there would be anything 
fundamentally backwards-incompatible about changing what is actually returned.

For #2, I think people almost universally consider it a bug or at the very 
least counter-intuitive that `DatetimeSubclass + timedelta` returns a datetime 
and not a DatetimeSubclass. There are many instances of people who create 
datetime subclasses like arrow and pendulum (for just two OSS examples) - all 
of them end up with fairly complicated implementations where they have to work 
around all the places where the underlying implementation has hard-coded 
datetime. Some of these have been fixed already, but it's a notorious game of 
whack-a-mole. I've never heard of a situation where someone *wants* the other 
behavior.

For #3, it is feasible that there are people who are accidentally relying on 
this behavior, but it would only be in pretty unpythonic code (like assert 
type(dt) == datetime), or when using broken datetime subclasses. The only 
situation where I can think of where this behavior might be desirable is if you 
have a thin datetime wrapper that only needs to be the wrapper class at the 
point of input, and afterwards you don't care what class it is (and as such 
you'd want it to be datetime, so as to take advantage of the fast paths in C 
code). That is far from the common case, and it's a "nice to have" - if it 
doesn't happen you'll get slower code, not broken code, and you can fix it the 
same way everyone else fixes their broken subclasses by overriding __add__ and 
__radd__.

I think there is a pretty compelling case for switching timedelta + 
datetimesubclass over to returning `datetimesubclass`.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20371] datetime.datetime.replace bypasses a subclass's __new__

2018-12-04 Thread Paul Ganssle


Paul Ganssle  added the comment:

This issue was fixed in Python 3.7, and it turns out issue 31222 was a 
duplicate of it. It can be closed now.

--
nosy: +p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20371] datetime.datetime.replace bypasses a subclass's __new__

2018-12-04 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> datetime.py implementation of .replace inconsistent with C 
implementation

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

2018-12-04 Thread Paul Ganssle


Paul Ganssle  added the comment:

Another thing to note: I'm pretty sure this was a mistake in the first place. 
There are many examples of places where the datetime module was just not 
designed with inheritance in mind, for example:

- issue 32404 / issue 32403 - fromtimestamp not calling __new__
- issue 31222 / 20371  - C implementation of .replace

I think there are many other unreported issues that all stem from similar 
inconsistencies that we've been slowly shoring up.

One problem is that it's very inconsistent, which makes datetime not 
particularly friendly to subclass, but to the extent that that's changing, 
we've been getting *more* friendly to subclasses.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +ghaering, xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
nosy: +lys.nikolaou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16482] pdb.set_trace() clobbering traceback on error

2018-12-04 Thread Aaron Meurer


Aaron Meurer  added the comment:

You can download the branch for a pull request even if the repo is deleted 
using this https://stackoverflow.com/a/28622034/161801. That will let you keep 
the original commits intact.

--
nosy: +asmeurer

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35398] SQLite incorrect row count for UPDATE

2018-12-04 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Did some debugging here. If I am understanding this correctly the rowcount is 
set at 
https://github.com/python/cpython/blob/b8e689a6e8134e88f857a55e50b6a4977967e385/Modules/_sqlite/cursor.c#L574
 . It checks for is_dml flag that is set here 
https://github.com/python/cpython/blob/b8e689a6e8134e88f857a55e50b6a4977967e385/Modules/_sqlite/statement.c#L78

The part to set is_dml skips space, tabs and newline and checks for the first 
set of characters that is not skipped to be insert, update, delete or replace 
and in this case the first set of characters to be matched will be "/* 
watermarking */". Thus with comment not matching, is_dml is not set and -1 is 
set for the rowcount.

--
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35235] Access violation on alloc in Windows x86-64 python, pymalloc_alloc

2018-12-04 Thread Mark Inderhees


Mark Inderhees  added the comment:

I have reproduced this with both PYTHONMALLOC=debug and "py -3.7 -x dev ", but it did not print out any allocation debug info. When using this 
option, it does take many more attempts to hit the issue than if running 
without debugging turned on.

Is there some other useful info I can gather?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32417] fromutc does not respect datetime subclasses

2018-12-04 Thread Paul Ganssle


Change by Paul Ganssle :


--
keywords: +patch
pull_requests: +10142
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

2018-12-04 Thread Paul Ganssle


Change by Paul Ganssle :


--
keywords: +patch
pull_requests: +10143
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35235] Access violation on alloc in Windows x86-64 python, pymalloc_alloc

2018-12-04 Thread Mark Inderhees


Mark Inderhees  added the comment:

Correction to my previous post. I did use capital X, ie '-X dev'.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid

2018-12-04 Thread Şahin

Şahin  added the comment:

OK, thank you all for information. It's now clear for me too why this is not an 
issue. I'll try to close this issue by selecting status as close but if it 
isn't working with this way (I'm new, I don't know how) anyone can close this.

--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35410] copy.deepcopy does not respect metaclasses with __deepcopy__ implementations

2018-12-04 Thread Eliot Bixby


New submission from Eliot Bixby :

__deepcopy__ implementations on metaclasses are ignored because deepcopy 
explicitly ignores class objects.

It seems to me that more consistent behavior would be to use a null op as a 
fallback for class objects that do not have any of the relevant methods 
implemented (deepcopy, reduce, reduce_ex, etc)

I've attached a PR that implements this.

--
components: Library (Lib)
messages: 331073
nosy: elibixby
priority: normal
pull_requests: 10144
severity: normal
status: open
title: copy.deepcopy does not respect metaclasses with __deepcopy__ 
implementations
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35390] ctypes not possible to pass NULL c_void_p in structure by reference

2018-12-04 Thread Dan


Dan  added the comment:

Thank you both, that's really helpful. Yes, I agree eryksun, I was saying that 
pointers to c_double and other normal pointer objects work fine, but that if 
you change to void* and c_void_p in my example it doesn't work. 

The private field seems like a reasonable solution, and I agree it would be 
useful for the offset attribute and perhaps that pattern to be documented. 
Thanks again for the quick responses.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29564] ResourceWarning: suggest to enable tracemalloc in the message

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0091f349cde179ea991f4ee4d095119cd1fc3802 by Victor Stinner (Miss 
Islington (bot)) in branch '3.7':
bpo-29564: warnings suggests to enable tracemalloc (GH-10486) (GH-10509)
https://github.com/python/cpython/commit/0091f349cde179ea991f4ee4d095119cd1fc3802


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29564] ResourceWarning: suggest to enable tracemalloc in the message

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35296] Install Include/internal/ header files

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b02774f42108aaf18eb19865472c8d5cd95b5f11 by Victor Stinner in 
branch '3.7':
bpo-35296: make install now installs the internal API (GH-10665) (GH-10897)
https://github.com/python/cpython/commit/b02774f42108aaf18eb19865472c8d5cd95b5f11


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35296] Install Include/internal/ header files

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35305] subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=PIPE) itself hangs/deadlocks (Linux)

2018-12-04 Thread HenrikB


HenrikB  added the comment:

Thanks for taking your time on this one.

I'll report back if I find out more about this kernel-specific issue.


Here're my replies to the outstanding questions/comments:

>> where the *child* process (`self.pid == 0`) get stuck while calling 
>> _dup2(c2pwrite = 4, 1) which in turn calls os.dup2(a = 4, b = 1).
> 
> Doesn't child process get stuck while writing stdout?

I'm not sure I understand; are you saying you would expect the child process to 
get stuck *before* reaching that line?  If so, no, it's in the _dup2(c2pwrite = 
4, 1) call where it (consistently) gets stuck.


> But I don't think the assertion makes sense.  I expect OSError rather
> than RuntimeError.

I only used RuntimeError here to keep it simple plus it wasn't obvious what the 
setup of OSError would be (I see that there is a FileNotFoundError in Python 3).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35411] FTP tests of test_urllib2net fail on Travis CI: 425 Security: Bad IP connecting.

2018-12-04 Thread STINNER Victor


New submission from STINNER Victor :

ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) 
(url='ftp://www.pythontest.net/README')
ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest)
ERROR: test_ftp_default_timeout (test.test_urllib2net.TimeoutTest)
ERROR: test_ftp_no_timeout (test.test_urllib2net.TimeoutTest)
ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest)

It seems like Jython has a similar issue:
http://bugs.jython.org/issue2708

Logs from Travis CI job of https://github.com/python/cpython/pull/10898:

https://travis-ci.org/python/cpython/jobs/463422586

Re-running test 'test_urllib2net' in verbose mode
test_close (test.test_urllib2net.CloseSocketTest) ... ok
test_custom_headers (test.test_urllib2net.OtherNetworkTests) ... ok
test_file (test.test_urllib2net.OtherNetworkTests) ... ok
test_ftp (test.test_urllib2net.OtherNetworkTests) ... 
test_redirect_url_withfrag (test.test_urllib2net.OtherNetworkTests) ... ok
test_sites_no_connection_close (test.test_urllib2net.OtherNetworkTests) ... 
skipped 'XXX: http://www.imdb.com is gone'
test_urlwithfrag (test.test_urllib2net.OtherNetworkTests) ... ok
test_ftp_basic (test.test_urllib2net.TimeoutTest) ... ERROR
test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ... 
/home/travis/build/python/cpython/Lib/urllib/request.py:222: ResourceWarning: 
unclosed 
  return opener.open(url, data, timeout)
/home/travis/build/python/cpython/Lib/urllib/request.py:222: ResourceWarning: 
unclosed 
  return opener.open(url, data, timeout)
/home/travis/build/python/cpython/Lib/urllib/request.py:222: ResourceWarning: 
unclosed 
  return opener.open(url, data, timeout)
ERROR
test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ... ERROR
test_ftp_timeout (test.test_urllib2net.TimeoutTest) ... ERROR
test_http_basic (test.test_urllib2net.TimeoutTest) ... ok
test_http_default_timeout (test.test_urllib2net.TimeoutTest) ... ok
test_http_no_timeout (test.test_urllib2net.TimeoutTest) ... ok
test_http_timeout (test.test_urllib2net.TimeoutTest) ... ok
==
ERROR: test_ftp (test.test_urllib2net.OtherNetworkTests) 
(url='ftp://www.pythontest.net/README')
--
Traceback (most recent call last):
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 1540, in 
ftp_open
fp, retrlen = fw.retrfile(file, type)
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 2404, in 
retrfile
conn, retrlen = self.ftp.ntransfercmd(cmd)
  File "/home/travis/build/python/cpython/Lib/ftplib.py", line 365, in 
ntransfercmd
resp = self.sendcmd(cmd)
  File "/home/travis/build/python/cpython/Lib/ftplib.py", line 273, in sendcmd
return self.getresp()
  File "/home/travis/build/python/cpython/Lib/ftplib.py", line 244, in getresp
raise error_temp(resp)
ftplib.error_temp: 425 Security: Bad IP connecting.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/travis/build/python/cpython/Lib/test/test_urllib2net.py", line 
219, in _test_urls
f = urlopen(url, req, TIMEOUT)
  File "/home/travis/build/python/cpython/Lib/test/test_urllib2net.py", line 
27, in wrapped
return _retry_thrice(func, exc, *args, **kwargs)
  File "/home/travis/build/python/cpython/Lib/test/test_urllib2net.py", line 
23, in _retry_thrice
raise last_exc
  File "/home/travis/build/python/cpython/Lib/test/test_urllib2net.py", line 
19, in _retry_thrice
return func(*args, **kwargs)
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 525, in 
open
response = self._open(req, data)
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 543, in 
_open
'_open', req)
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 503, in 
_call_chain
result = func(*args)
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 1551, in 
ftp_open
raise exc.with_traceback(sys.exc_info()[2])
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 1540, in 
ftp_open
fp, retrlen = fw.retrfile(file, type)
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 2404, in 
retrfile
conn, retrlen = self.ftp.ntransfercmd(cmd)
  File "/home/travis/build/python/cpython/Lib/ftplib.py", line 365, in 
ntransfercmd
resp = self.sendcmd(cmd)
  File "/home/travis/build/python/cpython/Lib/ftplib.py", line 273, in sendcmd
return self.getresp()
  File "/home/travis/build/python/cpython/Lib/ftplib.py", line 244, in getresp
raise error_temp(resp)
urllib.error.URLError: 
==
ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest)
--
Traceback (most recent call last):
  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 1540, in 
f

[issue35411] FTP tests of test_urllib2net fail on Travis CI: 425 Security: Bad IP connecting.

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

Another similar issue in a different project:
https://sagebionetworks.jira.com/browse/SYNPY-731

The fix... removed the test :-)
https://github.com/Sage-Bionetworks/synapsePythonClient/pull/571/files

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35412] test_future4 ran no test

2018-12-04 Thread STINNER Victor


New submission from STINNER Victor :

Since bpo-34279 has been fixed, regrtest now logs a message when a test runs no 
test. I noticed that test_future4 logs such message:

...
0:05:23 load avg: 0.56 [152/412] test_future4
0:05:24 load avg: 0.56 [153/412] test_future5 -- test_future4 run no tests
...
2 tests run no tests:
test_dtrace test_future4

I can reproduce the issue:

$ ./python -m test test_future4
(...)
test_future4 run no tests
(...)
Tests result: NO TEST RUN

The test has been added by:
commit 62e2c7e3dfffd8465a54b99fc6d3c2a60acab350
Author: Jeremy Hylton 
Date:   Wed Feb 28 17:48:06 2001 +

Add regression test for future statements.  This adds eight files, but
seven are not tests in their own right; these files are mentioned in
regrtest.

diff --git a/Lib/test/test_future4.py b/Lib/test/test_future4.py
new file mode 100644
index 00..805263be89
--- /dev/null
+++ b/Lib/test/test_future4.py
@@ -0,0 +1,10 @@
+"""This is a test"""
+import __future__
+from __future__ import nested_scopes
+
+def f(x):
+def g(y):
+return x + y
+return g
+
+print f(2)(4)



... test removed by commit 3090694068670371cdbd5b1a3d3c5dbecc83835a.

A file recreated by:

commit fa50bad9578cf32e6adcaf52c3a58c7b6cd81e30
Author: Christian Heimes 
Date:   Wed Mar 26 22:55:31 2008 +

I forgot to svn add the future test


... I guess that it's related to:

commit 3c60833e1e53f6239825b44f76fa22172feb1790
Author: Christian Heimes 
Date:   Wed Mar 26 22:01:37 2008 +

Patch #2477: Added from __future__ import unicode_literals

The new PyParser_*Ex() functions are based on Neal's suggestion and initial 
patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and 
br'' stay (byte) strings.

(Other candidates: commit 342212c52afd375d93f44f3ecda0914d77372f26 and commit 
7f23d86107dfea69992322577c5033f2edbc3b4f.)

--
messages: 331080
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test_future4 ran no test
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35411] FTP tests of test_urllib2net fail on Travis CI: 425 Security: Bad IP connecting.

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +10145
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35411] FTP tests of test_urllib2net fail on Travis CI: 425 Security: Bad IP connecting.

2018-12-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10146

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35411] FTP tests of test_urllib2net fail on Travis CI: 425 Security: Bad IP connecting.

2018-12-04 Thread STINNER Victor


STINNER Victor  added the comment:

According to my PR 10906, FTP tests of test_urllib2net now also fail each time 
on master (not all of them, at least two tests fail).

I wrote PR 10907 to skip the tests on Travis CI. We have AppVeyor to run these 
tests in pre-commit, and the buildbot farm to test in post-commit.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >