[issue39499] ValueError using index on tuple is not showing the tuple value

2020-01-29 Thread Oscar


New submission from Oscar :

When trying to retrieve the index of an element that is not in a tuple the 
error message of ValueError is not showing the value looking for but instead a 
static message tuple.index(x): x not in tuple

>>> b = (1, 2, 3, 4)
>>> b.index(5)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: tuple.index(x): x not in tuple

I would expect something like what happen in lists where the element (5 in this 
case) is showed on the ValueError.
>>> a = [1, 2, 3, 4]
>>> a.index(5)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: 5 is not in list

--
messages: 361016
nosy: tuxskar
priority: normal
severity: normal
status: open
title: ValueError using index on tuple is not showing the tuple value
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



[issue39495] xml.etree.ElementTree.TreeBuilder.start differs between pure Python and C implementations

2020-01-29 Thread Shantanu


Change by Shantanu :


--
keywords: +patch
pull_requests: +17650
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18275

___
Python tracker 

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



[issue39495] xml.etree.ElementTree.TreeBuilder.start differs between pure Python and C implementations

2020-01-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

According to the documentation the attrs parameter does not have default value. 
I think that the C implementation should be changed.

https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.TreeBuilder.start

--

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-29 Thread miss-islington


miss-islington  added the comment:


New changeset ad4a20b87d79a619ffbdea3f26848780899494e5 by Steve Dower in branch 
'3.8':
[3.8] bpo-39401: Avoid unsafe DLL load on Windows 7 and earlier (GH-18231) 
(GH-18234)
https://github.com/python/cpython/commit/ad4a20b87d79a619ffbdea3f26848780899494e5


--

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-29 Thread miss-islington


miss-islington  added the comment:


New changeset 561c59777c8426fde0ef48b57cf02eddaeb2a5b8 by Steve Dower in branch 
'3.7':
[3.7] bpo-39401: Avoid unsafe DLL load on Windows 7 and earlier (GH-18231) 
(GH-18232)
https://github.com/python/cpython/commit/561c59777c8426fde0ef48b57cf02eddaeb2a5b8


--
nosy: +miss-islington

___
Python tracker 

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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 194c7aeb6f3d6c2b0015457d22b38253652f4f38 by Miss Islington (bot) 
in branch '3.7':
[3.7] bpo-39493: Fix definition of IO.closed in typing.py (GH-18273)
https://github.com/python/cpython/commit/194c7aeb6f3d6c2b0015457d22b38253652f4f38


--

___
Python tracker 

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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks, Shantanu!

--
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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread miss-islington


miss-islington  added the comment:


New changeset 58076df0c59677111dc77b72852cb2a313a2ef91 by Miss Islington (bot) 
in branch '3.8':
bpo-39493: Fix definition of IO.closed in typing.py (GH-18265)
https://github.com/python/cpython/commit/58076df0c59677111dc77b72852cb2a313a2ef91


--
nosy: +miss-islington

___
Python tracker 

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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17649
pull_request: https://github.com/python/cpython/pull/18274

___
Python tracker 

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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17648
pull_request: https://github.com/python/cpython/pull/18273

___
Python tracker 

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



[issue39498] Signpost security considerations in library

2020-01-29 Thread anthony shaw


Change by anthony shaw :


--
keywords: +patch
pull_requests: +17647
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18272

___
Python tracker 

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



[issue39498] Signpost security considerations in library

2020-01-29 Thread anthony shaw


New submission from anthony shaw :

Within the documentation, there are some really important security 
considerations for standard library modules. e.g. subprocess, ssl, pickle, xml.

There is currently no "index" of these, so you have to go hunting for them. 
They're easter eggs within the docs. There isn't a unique admonition type 
either, so you have to search across many criteria.

In particular for security researchers, it would be useful to consolidate and 
signpost these security best-practices in one index.

PR to follow,

--
assignee: docs@python
components: Documentation
messages: 361009
nosy: anthonypjshaw, docs@python
priority: normal
severity: normal
status: open
title: Signpost security considerations in library
type: enhancement

___
Python tracker 

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



[issue39497] Unused variable script_str in pysqlite_cursor_executescript

2020-01-29 Thread Alex Henrie


Change by Alex Henrie :


--
keywords: +patch
pull_requests: +17646
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18271

___
Python tracker 

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



[issue39497] Unused variable script_str in pysqlite_cursor_executescript

2020-01-29 Thread Alex Henrie


New submission from Alex Henrie :

The function pysqlite_cursor_executescript defines a variable called 
script_str, initializes it to NULL, and calls Py_XDECREF on it. However, this 
variable has been unused since August 2007: 
https://github.com/python/cpython/commit/6d21456137836b8acd551cf6a51999ad4ff10a91#diff-26f74db3527991715b482a5ed2603870L752

--
components: Library (Lib)
messages: 361008
nosy: alex.henrie
priority: normal
severity: normal
status: open
title: Unused variable script_str in pysqlite_cursor_executescript
type: performance
versions: Python 3.9

___
Python tracker 

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



[issue39494] Extra null terminators in keyword arrays in sqlite module

2020-01-29 Thread Berker Peksag


Change by Berker Peksag :


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

___
Python tracker 

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



[issue39494] Extra null terminators in keyword arrays in sqlite module

2020-01-29 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 188bb5b1e868eecf2342195dc45caa332ac3b6c7 by Alex Henrie in branch 
'master':
bpo-39494: Remove extra null terminators from kwlist vars (GH-18267)
https://github.com/python/cpython/commit/188bb5b1e868eecf2342195dc45caa332ac3b6c7


--
nosy: +berker.peksag

___
Python tracker 

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



[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-29 Thread Alex Henrie


Change by Alex Henrie :


--
keywords: +patch
pull_requests: +17645
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18270

___
Python tracker 

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



[issue39496] Inelegant loops in Modules/_sqlite/cursor.c

2020-01-29 Thread Alex Henrie


New submission from Alex Henrie :

pysqlite_cursor_fetchall currently has the following bit of code:

/* just make sure we enter the loop */
row = (PyObject*)Py_None;

while (row) {
row = pysqlite_cursor_iternext(self);
if (row) {
PyList_Append(list, row);
Py_DECREF(row);
}
}

This can and should be rewritten as a for loop to avoid the unnecessary 
initialization to Py_None and the redundant if statement inside the loop.

pysqlite_cursor_fetchmany has the same problem.

--
components: Library (Lib)
messages: 361006
nosy: alex.henrie
priority: normal
severity: normal
status: open
title: Inelegant loops in Modules/_sqlite/cursor.c
type: performance
versions: Python 3.9

___
Python tracker 

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



[issue39495] xml.etree.ElementTree.TreeBuilder.start differs between pure Python and C implementations

2020-01-29 Thread Shantanu


Shantanu  added the comment:

Based on 
https://github.com/python/cpython/blob/master/Modules/_elementtree.c#L2700 and 
the behaviour at runtime, something like the following patch could work:
```
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py
index c8d898f328..bbfc1afe08 100644
--- a/Lib/xml/etree/ElementTree.py
+++ b/Lib/xml/etree/ElementTree.py
@@ -1452,7 +1452,7 @@ class TreeBuilder:
 """Add text to current element."""
 self._data.append(data)
 
-def start(self, tag, attrs):
+def start(self, tag, attrs=None):
 """Open new element and return it.
 
 *tag* is the element name, *attrs* is a dict containing element
@@ -1460,6 +1460,8 @@ class TreeBuilder:
 
 """
 self._flush()
+if attrs is None:
+attrs = {}
 self._last = elem = self._factory(tag, attrs)
 if self._elem:
 self._elem[-1].append(elem)
```

Happy to submit a PR!

--

___
Python tracker 

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



[issue39495] xml.etree.ElementTree.TreeBuilder.start differs between pure Python and C implementations

2020-01-29 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eli.bendersky, scoder, serhiy.storchaka

___
Python tracker 

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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 2e6569b6692298fcc9aae0df3eb3181adb2a5099 by Shantanu in branch 
'master':
bpo-39493: Fix definition of IO.closed in typing.py (#18265)
https://github.com/python/cpython/commit/2e6569b6692298fcc9aae0df3eb3181adb2a5099


--
nosy: +gvanrossum

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2020-01-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I verified problem for KeyboardInterrupt and RestartShell but not for a newline 
that actually runs the statement.  In my experiments, if a newline in inserted 
instead of running, the cursor remains within a call and the calltip should not 
disappear.

--

___
Python tracker 

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



[issue39495] xml.etree.ElementTree.TreeBuilder.start differs between pure Python and C implementations

2020-01-29 Thread Shantanu


New submission from Shantanu :

The C accelerated version of `xml.etree.ElementTree.TreeBuilder.start` has a 
default value for `attrs`, whereas the pure Python version does not.

```
In [41]: sys.version
   
Out[41]: '3.8.1 (default, Jan 23 2020, 23:36:06) \n[Clang 11.0.0 
(clang-1100.0.33.17)]'

In [42]: import xml.etree.ElementTree   
   

In [43]: inspect.signature(xml.etree.ElementTree.TreeBuilder.start) 
   
Out[43]: 

In [44]: from test.support import import_fresh_module   
   

In [45]: pyElementTree = import_fresh_module('xml.etree.ElementTree', 
blocked=['_elementtree'])

In [46]: inspect.signature(pyElementTree.TreeBuilder.start) 
   
Out[46]: 
```

>From PEP 399 (https://www.python.org/dev/peps/pep-0399/)
```
Acting as a drop-in replacement also dictates that no public API be provided in 
accelerated code that does not exist in the pure Python code. Without this 
requirement people could accidentally come to rely on a detail in the 
accelerated code which is not made available to other VMs that use the pure 
Python implementation. 
```

--
components: Library (Lib)
messages: 361002
nosy: hauntsaninja
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree.TreeBuilder.start differs between pure Python and 
C implementations

___
Python tracker 

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



[issue39494] Extra null terminators in keyword arrays in sqlite module

2020-01-29 Thread Alex Henrie


Change by Alex Henrie :


--
keywords: +patch
pull_requests: +17644
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18267

___
Python tracker 

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



[issue39494] Extra null terminators in keyword arrays in sqlite module

2020-01-29 Thread Alex Henrie


New submission from Alex Henrie :

Modules/_sqlite/cursor.c currently has the following variable declaration:

static char *kwlist[] = {"size", NULL, NULL};

The second null terminator is unnecessary and detrimental in that it makes the 
code harder to read and understand.

Modules/_sqlite/module.c has two additional kwlist variables with the same 
problem.

--
components: Library (Lib)
messages: 361001
nosy: alex.henrie
priority: normal
severity: normal
status: open
title: Extra null terminators in keyword arrays in sqlite module
type: resource usage
versions: Python 3.9

___
Python tracker 

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



[issue33339] Using default encoding with `subprocess.run()` is not obvious

2020-01-29 Thread Eryk Sun


Eryk Sun  added the comment:

This issue was already addressed for 3.x in bpo-31756, which added the a `text` 
parameter and updated the documentation. As to 2.7, it was officially retired 
as of the first of this month. Anyway, I don't think there was a pressing need 
to clarify the documentation in 2.7.

--
nosy: +eryksun
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> subprocess.run should alias universal_newlines to text

___
Python tracker 

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



[issue39492] reference cycle affecting Pickler instances (Python3.8+)

2020-01-29 Thread Pierre Glaser


Change by Pierre Glaser :


--
keywords: +patch
pull_requests: +17643
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18266

___
Python tracker 

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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread Shantanu


Change by Shantanu :


--
keywords: +patch
pull_requests: +17642
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18265

___
Python tracker 

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



[issue39320] Handle unpacking of */** arguments and rvalues in the compiler

2020-01-29 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +17641
pull_request: https://github.com/python/cpython/pull/18264

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-29 Thread Steve Dower


Steve Dower  added the comment:

> I added 
> https://python-security.readthedocs.io/vuln/unsafe-dll-load-windows-7.html to 
> track fixes in all branches.

Thanks, Victor!

Python 2.7 and 3.5 are not vulnerable. The issue was added in 3.6 when I added 
support for installing Python into a long path name on up-to-date OS, which 
required dynamically loading an OS function. That dynamic load was the problem.

--

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-29 Thread Steve Dower


Steve Dower  added the comment:

Both of those buildbots should be retired (or repurposed for versions of Python 
that still support Windows 7) :)

--

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-29 Thread Eryk Sun


Eryk Sun  added the comment:

> this PR has caused failures of 2 buildbots

The master branch should no longer get built on Windows 7 machines. The initial 
build succeeds, but running "_freeze_importlib[_d].exe" fails with 
STATUS_DLL_NOT_FOUND (0xC135, i.e. -1073741515) since 
"api-ms-win-core-path-l1-1-0.dll" (linked from pathcch.lib) is not a Windows 7 
API set.

--

___
Python tracker 

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



[issue39493] typing.py has an incorrect definition of closed

2020-01-29 Thread Shantanu


New submission from Shantanu :

Hello!

typing.py has the following definition of `closed`:
https://github.com/python/cpython/blob/master/Lib/typing.py#L1834
```
@abstractmethod
def closed(self) -> bool:
pass
```

This is inconsistent with the behaviour at runtime:
```
In [17]: sys.version
  
Out[17]: '3.8.1 (default, Jan 23 2020, 23:36:06) \n[Clang 11.0.0 
(clang-1100.0.33.17)]'

In [18]: f = open("test", "w")  
  

In [19]: f.closed   
  
Out[19]: False
```

It seems like the right thing to do is add an @property, as we do with e.g. 
`mode` and `name`. I'll submit a PR with this change.

Note typeshed also types this as a property to indicate a read-only attribute.
https://github.com/python/typeshed/blob/master/stdlib/3/typing.pyi#L459

First time filing a bug on BPO, thanks a lot in advance!

--
messages: 360996
nosy: hauntsaninja
priority: normal
severity: normal
status: open
title: typing.py has an incorrect definition of closed
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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17640
pull_request: https://github.com/python/cpython/pull/18263

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17639
pull_request: https://github.com/python/cpython/pull/18262

___
Python tracker 

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



[issue39492] reference cycle affecting Pickler instances (Python3.8+)

2020-01-29 Thread Pierre Glaser


New submission from Pierre Glaser :

The new Pickler reducer_override mechanism introduced in `Python3.8` generates 
a reference cycle: for optimization purposes, a the pickler.reducer_override 
bound method is referenced into the reducer_override attribute of the Pickler's 
struct. Thus, until as a gc.collect call is performed, both the Pickler and all 
the elements it pickled (as they are part of its memo), wont be collected.

We should break this cycle a the end of the dump() method.

See reproducer below:
```
import threading
import weakref
import pickle
import io


class MyClass:
pass


my_object = MyClass()
collect = threading.Event()
_ = weakref.ref(my_object, lambda obj: collect.set())  # noqa


class MyPickler(pickle.Pickler):
def reducer_override(self, obj):
return NotImplemented


my_pickler = MyPickler(io.BytesIO())
my_pickler.dump(my_object)
del my_object
del my_pickler

# import gc
# gc.collect()

for i in range(5):
collected = collect.wait(timeout=0.1)
if collected:
print('my_object was successfully collected')
break
```

--
components: Library (Lib)
messages: 360995
nosy: pierreglaser, pitrou
priority: normal
severity: normal
status: open
title: reference cycle affecting Pickler instances (Python3.8+)
type: resource usage
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17638
pull_request: https://github.com/python/cpython/pull/18258

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-29 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

As noted on the PR landing page, this PR has caused failures of 2 buildbots:

https://buildbot.python.org/all/#builders/81/builds/272

https://buildbot.python.org/all/#builders/150/builds/227

(both are Windows 7)

--
nosy: +jkloth

___
Python tracker 

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



[issue39488] test_largefile: TestSocketSendfile.test_it() uses too much disk space

2020-01-29 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
keywords: +patch
pull_requests: +17637
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18261

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

> That means this is a useful refactoring to help identify blockers to full 
> subinterpreter support.

I don't think that subinterpreter support should block this issue, since 
currently, _Py_IDENTIFIER() does *not* support subinterpreters.

> In the subinterpreter context: perhaps it would make sense to move *all* 
> Py_IDENTIFIER declarations to file scope?

What do you mean? _Py_IDENTIFIER() macro uses "static", so no identifier is 
visible outside the current C file. The scope may be the whole file, or the 
current function, depending where it's declared.

--

Once I discussed with Eric: _Py_IDENTIFIER() should use an "interpreter local 
storage" for identifiers values. _Py_IDENTIFIER() would only be a "key" and 
_PyUnicode_FromId() would store the value somewhere in a hash table stored in 
PyInterpreterState. Something similar to the TSS API:

* PyThread_create_key()
* PyThread_delete_key_value()
* PyThread_set_key_value()
* PyThread_get_key_value()

But per interpreter, rather than being per thread.

The key can be simply the variable address in memory. It only has to be unique 
in the process.

--

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread Nick Coghlan


Nick Coghlan  added the comment:

In the subinterpreter context: perhaps it would make sense to move *all* 
Py_IDENTIFIER declarations to file scope?

That would make it much clearer which of our extension modules actually have 
hidden state for caching purposes.

If we did that though, we'd also want to update the usage instructions in 
object.h

--

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread Nick Coghlan


Nick Coghlan  added the comment:

My apologies, my comment above was based on an outdated understanding of how 
the identifier structs get initialised (it's the usage that initialises them, 
not the declaration).

That means this is a useful refactoring to help identify blockers to full 
subinterpreter support.

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

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread Nick Coghlan


Nick Coghlan  added the comment:

We can't make this change, as it means the statics get initialised before the 
Python interpreter has been initialised, and won't be reinitialised if the 
interpreter is destroyed and recreated.

--
nosy: +ncoghlan
resolution:  -> rejected
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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-29 Thread Tim Peters


Tim Peters  added the comment:

+0 from me.

Another use is computing the Carmichael function for composite numbers (like an 
RSA encryption modulus, in which context the Carmichael function is routinely 
used).

But only +0 instead of +1 because it's so easy to build from gcd().

I don't agree it's tricky at all.  While lcm(0, 0) undoubtedly should return 0 
in a general-purpose library function, in my own code I've never supplied that. 
 Because in every application I've ever had for it, I would rather get an 
exception if I ever passed two zeroes - that would always have been a mistake.

--
nosy: +tim.peters

___
Python tracker 

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



[issue39491] Import PEP 593 (Flexible function and variable annotations) support already implemented in typing_extensions

2020-01-29 Thread Jakub Stasiak


Change by Jakub Stasiak :


--
keywords: +patch
pull_requests: +17636
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18260

___
Python tracker 

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



[issue39491] Import PEP 593 (Flexible function and variable annotations) support already implemented in typing_extensions

2020-01-29 Thread Jakub Stasiak


Change by Jakub Stasiak :


--
components: Library (Lib)
nosy: jstasiak
priority: normal
severity: normal
status: open
title: Import PEP 593 (Flexible function and variable annotations) support 
already implemented in typing_extensions
versions: Python 3.9

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

I looked for "Python COUNT_ALLOCS" on the Internet. This special build seems to 
be very badly documented on the Internet. Outside Python own documentation, I 
found almost zero reference to it. IMHO it's basically unused.


(*) bpo-33058: Two years ago (2018), attempt to make COUNT_ALLOCS build ABI 
compatible with release build. Extract:

> > Could tracemalloc help you?
> tracemalloc can't distinguish between the usage of gc allocs, normal mallocs, 
> and free list reuse.


(*) Documentation of all Python builds:

https://pythonextensionpatterns.readthedocs.io/en/latest/debugging/debug_python.html#debug-version-of-python-count-allocs-label

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

The COUNT_ALLOCS feature itself is quite old. It was added 27 years ago (in 
1993):

commit a9c3c22c33762699b362e7598268442fd2df9eb6
Author: Sjoerd Mullender 
Date:   Mon Oct 11 12:54:31 1993 +

* Extended X interface: pixmap objects, colormap objects visual objects,
  image objects, and lots of new methods.
* Added counting of allocations and deallocations of builtin types if
  COUNT_ALLOCS is defined.  Had to move calls to NEWREF down in some
  files.
* Bug fix in sorting lists.

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

Python 2.7.15 got a PYTHONSHOWALLOCCOUNT environment variable to dump 
statistics on types at exit, if Python is built with COUNT_ALLOCS macro defined.

Example with Fedora python2.7-debug (package 
python2-debug-2.7.17-1.fc31.x86_64):

$ PYTHONSHOWALLOCCOUNT=1 python2.7-debug -c pass
exceptions.ImportError alloc'd: 2, freed: 2, max in use: 1
symtable entry alloc'd: 3, freed: 3, max in use: 1
enumerate alloc'd: 2, freed: 2, max in use: 1
dict alloc'd: 459, freed: 220, max in use: 346
str alloc'd: 13981, freed: 12142, max in use: 5991
tuple alloc'd: 5088, freed: 4096, max in use: 2337
(...)
fast tuple allocs: 2434, empty: 1753
fast int allocs: pos: 875, neg: 74
null strings: 81, 1-strings: 328

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

As far as I known, the Fedora package of Python is the most known user of 
COUNT_ALLOCS special build, and maybe the only user.

The Fedora package of Python 2.7 builds two binaries:

* python2.7: release mode, optimized
* python2.7-debug: debug mode, not optimized, built with COUNT_ALLOCS defined

Sadly, in practice, python2.7-debug is basically unusable since C extensions 
providing by Fedora are not compatible: the release and the debug modes have a 
different ABI. I only fixed this recently in Python 3.8.

It uses COUNT_ALLOCS since the following patch (package version 2.6.5-10, in 
2010) written by Dave Malcolm.


(1) There is a downstream patch adding --with-count-allocs flag to configure. 
Patch added to package version 2.6.5-10, in 2010:
https://src.fedoraproject.org/rpms/python2/c/ab11e4c10f6fef4e2e993ef446953df0f0dbb840


(2) Another downstream patch adds PYTHONDUMPCOUNTS environment variable to only 
dump statistics if the variable is set. Patch added to package version 2.7-8, 
in 2010:
https://src.fedoraproject.org/rpms/python2/c/5810c5d8b1c876ccc4c547cc71cf20520dd27d85

=> this patch was proposed upstream in bpo-19527. I merged it in Python 2.7.15 
(in 2017), but with a different environment variable name: PYTHONSHOWALLOCCOUNT.


(3) Finally, a 3rd downstream patch fix test_abc when COUNT_ALLOCS is defined. 
Patch added to package version 2.7.1-1, in 2010:
https://src.fedoraproject.org/rpms/python2/c/4b97eebe22c8c5db58ae65cdc7e79c3ccd45b0a4

=> Bohuslav "Slavek" Kabrda created bpo-19527 to propose to make multiple test 
fixes upstream. Serhiy Storchaka modified the proposed patch by adding 
@test.support.requires_type_collecting decorator. Change merged in 3.5 and 
default branches, but not in 2.7.


Another example of Fedora contribution: bpo-31692 reports that test_regrtest 
fails when Python 2.7.14 is built with COUNT_ALLOCS.

---

Now, the interesting part.

IMHO COUNT_ALLOCS was basically kept between 2010 and 2015 because "it was 
there" and nobody asked if it still made sense to use it. It wasn't too 
expensive to maintain in the Fedora package... until someone asked if it's 
still worth it to maintain it in 2015.

The COUNT_ALLOCS macro has been removed from the Fedora package of Python 3 in 
2015:

* https://bugzilla.redhat.com/show_bug.cgi?id=1291325
* "[cleanup] Remove COUNT_ALLOCS patches, see rhbz#1291325" commit:
  
https://src.fedoraproject.org/rpms/python3/c/19aade22cbfa57dc500f5fa82229b4b9ed0b4c30

Extract of the bugzilla, "Reply from Dave Malcolm":
"""
My hazy recollection is that at the time I was dealing with lots of
memory leak issues in Python 2, so I was keen to add as much help as
possible in tracking them down to Python 2 and Python 3.

I don't think this patch ever really bought us much, and it sounds like
there are better tools for this now, so feel free to drop the
COUNT_ALLOC patches.
"""

It confirms what I wrote in the initial message of this issue: there are now 
better tool to track Python memory leaks.

Supporting COUNT_ALLOC in the Fedora package was motivated by Dave Malcolm use 
case of tracking memory leak, but even Dave wrote: "I don't think this patch 
ever really bought us much".

--

___
Python tracker 

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



[issue39490] Python Uninstaller fails to clean up the old path variables when uninstalling

2020-01-29 Thread CJ Long


New submission from CJ Long :

I had Python 3.7 installed on my machine. However, I started having issues with 
it, so I uninstalled Python. However, when I reinstalled and attempted to run 
pip from Powershell, the old path was still in my variable, and therefore, 
could not run pip. Python still works.

--
components: Installation
messages: 360984
nosy: brucelong
priority: normal
severity: normal
status: open
title: Python Uninstaller fails to clean up the old path variables when 
uninstalling
type: behavior
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



[issue39483] Proposial add loop parametr to run in asyncio

2020-01-29 Thread Андрей Казанцев

Андрей Казанцев  added the comment:

How to make singleton class? I wrote this 

```
import asyncio


class Singleton:
_CREATE_LOCK = asyncio.Lock()

@classmethod
async def create(cls):
if not hasattr(cls, '_Singleton__instance'):
async with cls._CREATE_LOCK:
if not hasattr(cls, '_Singleton__instance'):
await asyncio.sleep(1)
cls.__instance = cls()
return cls.__instance


async def main():
await asyncio.wait([
Singleton.create(),
Singleton.create(),
])


if __name__ == '__main__':
asyncio.run(main())
```

and got `RuntimeError`

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I have never used this feature either.

--
nosy: +rhettinger

___
Python tracker 

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



[issue38628] Issue with ctypes in AIX

2020-01-29 Thread David Edelsohn


Change by David Edelsohn :


--
nosy: +David.Edelsohn, Michael.Felt

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-01-29 Thread Vincent Michel


Vincent Michel  added the comment:

I thought about it a bit more and I realized there is no way to recover the 
time in hundreds of nanoseconds from the float produced by `time.time()` (since 
the windows time currently takes 54 bits and will take 55 bits in 2028). 

That means `time()` and `time_ns()` cannot be compared by converting time() to 
nanoseconds, but it might still make sense to compare them by converting 
time_ns() to seconds (which is apparently broken at the moment).

If that makes sense, a possible roadmap to tackle this problem would be:
- fix `_PyTime_AsSecondsDouble` so that `time.time_ns() / 10**9 == time.time()`
- add a warning in the documentation that one should be careful when comparing 
the timestamps produced by `time()` and time_ns()` (in particular, `time()` 
should not be converted to nanoseconds)

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +17634
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18259

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-19527 which discussed COUNT_ALLOCS in 2013.

COUNT_ALLOCS build is documented in Fedora "DebugPythonStacks" wiki page:
https://fedoraproject.org/wiki/Features/DebugPythonStacks#Verify_COUNT_ALLOCS

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-29 Thread STINNER Victor


New submission from STINNER Victor :

Python has a COUNT_ALLOCS special build which adds sys.getcounts() function and 
shows statistics on Python types at exit if -X showalloccount command line 
option is used.

I never ever used this feature and I don't know anyone using it.

But "#ifdef COUNT_ALLOCS" code is scattered all around the code. It requires 
maintenance. I propose to remove the code to ease maintenance.

Attached PR shows how much code is requires to support this special build.

There are now more advanced tools to have similar features:

* tracemalloc can be used to track memory leaks
* gc.getobjects() can be called frequently to compute statistics on Python types
* There are many tools built around gc.getobjects()

The previous large change related to COUNT_ALLOCS was done in Python 3.6 by 
bpo-23034:

"The output of a special Python build with defined COUNT_ALLOCS, 
SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can be 
re-enabled using the -X showalloccount option. It now outputs to stderr instead 
of stdout. (Contributed by Serhiy Storchaka in bpo-23034.)"

https://docs.python.org/dev/whatsnew/3.6.html#changes-in-python-command-behavior

--
components: Build
messages: 360978
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove COUNT_ALLOCS special build
versions: Python 3.9

___
Python tracker 

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



[issue39486] bug in %-formatting in Python, related to escaped %-characters

2020-01-29 Thread SilentGhost


Change by SilentGhost :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39486] bug in %-formatting in Python, related to escaped %-characters

2020-01-29 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

Ok, that means it's intentional. I still think it's missing a documentation 
change and consistent error messages.

--

___
Python tracker 

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



[issue39488] test_largefile: TestSocketSendfile.test_it() uses too much disk space

2020-01-29 Thread STINNER Victor


New submission from STINNER Victor :

TestSocketSendfile.test_it() failed with "OSError: [Errno 28] No space left on 
device" on PPC64LE Fedora 3.x buildbot.

It also caused troubles on "AMD64 Fedora Rawhide Clang 3.x" worker.

If I recall correctly, it writes like 8 GB of real data, not just empty files 
made of holes.

I suggest to either remove the test or to use way less disk space.

https://buildbot.python.org/all/#builders/11/builds/259

Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64le/build/Lib/test/test_largefile.py",
 line 161, in test_it
shutil.copyfile(TESTFN, TESTFN2)
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64le/build/Lib/shutil.py",
 line 270, in copyfile
_fastcopy_sendfile(fsrc, fdst)
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64le/build/Lib/shutil.py",
 line 163, in _fastcopy_sendfile
raise err from None
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64le/build/Lib/shutil.py",
 line 149, in _fastcopy_sendfile
sent = os.sendfile(outfd, infd, offset, blocksize)
OSError: [Errno 28] No space left on device: '@test_38097_tmp' -> 
'@test_38097_tmp2'

--
components: Tests
keywords: buildbot
messages: 360976
nosy: giampaolo.rodola, vstinner
priority: normal
severity: normal
status: open
title: test_largefile: TestSocketSendfile.test_it() uses too much disk space
versions: Python 3.9

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

> FYI, I'm able to reproduce the hang by running "python -m test -F 
> test_asyncio -m test_close_kill_running". Working on the fix.

Any update on this issue? It's still failing randomly on buildbots. Example:
https://buildbot.python.org/all/#/builders/158/builds/64

Another option is to skip the test_close_kill_running() until it's fixed which 
usually means forget about it until an user gets the bug for real in production.

--

___
Python tracker 

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



[issue39486] bug in %-formatting in Python, related to escaped %-characters

2020-01-29 Thread SilentGhost


SilentGhost  added the comment:

This seemed to be a consequence of #29568.

--
components: +Interpreter Core
nosy: +SilentGhost
type:  -> behavior

___
Python tracker 

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



[issue37972] unittest.mock.call does not chain __getitem__ to another _Call object

2020-01-29 Thread Chris Withers


Chris Withers  added the comment:


New changeset db5e86adbce12350c26e7ffc2c6673369971a2dc by Chris Withers in 
branch 'master':
Get mock coverage back to 100% (GH-18228)
https://github.com/python/cpython/commit/db5e86adbce12350c26e7ffc2c6673369971a2dc


--

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread Eric Snow


Eric Snow  added the comment:

FTR:

As Martin noted in #19514, there isn't any performance difference for statics, 
whether local or global.  For static locals the compiler (at least on linux) 
generates symbols named as ".<#>" and they are treated as global.

One key difference (again, at least on linux; seen using "nm") is that symbols 
for static globals preserve identifying information, like the originating 
source file.  For static locals the filename is not preserved and, when there 
are duplicates, you do not know from which function a particular symbol comes.  
So compiled symbols for static globals are *much* easier to identify in the 
source than symbols for static locals.

Hence static locals complicate something I'm working on: tooling to identify 
global variables in our source code.  So I'm a fan of efforts to remove 
duplicates (and move static locals to the explicit global namespace).  Thank 
you! :)

--
nosy: +eric.snow

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers


Chris Withers  added the comment:

Thank you very much for this, that was a really good catch!

--
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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers


Chris Withers  added the comment:


New changeset 696d2324cf2a54e20e8d6a6739fa97ba815a8be9 by Miss Islington (bot) 
in branch '3.8':
bpo-39485: fix corner-case in method-detection of mock (GH-18255)
https://github.com/python/cpython/commit/696d2324cf2a54e20e8d6a6739fa97ba815a8be9


--

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers


Chris Withers  added the comment:


New changeset cf0645a17acbc0c4dbbf82434e37637965748bbb by Miss Islington (bot) 
in branch '3.7':
bpo-39485: fix corner-case in method-detection of mock (GH-18256)
https://github.com/python/cpython/commit/cf0645a17acbc0c4dbbf82434e37637965748bbb


--

___
Python tracker 

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



[issue33339] Using default encoding with `subprocess.run()` is not obvious

2020-01-29 Thread Xavier Robin


Change by Xavier Robin :


--
nosy: +Xavier Robin

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers


Chris Withers  added the comment:


New changeset a327677905956ae0b239ff430a1346dfe265709e by Carl Friedrich 
Bolz-Tereick in branch 'master':
bpo-39485: fix corner-case in method-detection of mock (GH-18252)
https://github.com/python/cpython/commit/a327677905956ae0b239ff430a1346dfe265709e


--

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17633
pull_request: https://github.com/python/cpython/pull/18256

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17632
pull_request: https://github.com/python/cpython/pull/18255

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Chris Withers


Change by Chris Withers :


--
assignee:  -> cjw296

___
Python tracker 

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



[issue15600] expose the finder details used by the FileFinder path hook

2020-01-29 Thread Eric Snow


Eric Snow  added the comment:

I have many other things higher on my todo list. :)  I'll re-open this issue if 
I get back to the project that motivated this (i.e. "source translation via 
import hooks for filename suffix").

--
resolution:  -> out of date
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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread hai shi


Change by hai shi :


--
nosy: +vstinner

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread hai shi


Change by hai shi :


--
keywords: +patch
pull_requests: +17631
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18254

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-29 Thread hai shi


New submission from hai shi :

As stinner said in issue19514

those _Py_IDENTIFIER should be merged:

./Modules/_ctypes/_ctypes.c:1054:_Py_IDENTIFIER(_type_);
./Modules/_ctypes/_ctypes.c:1132:_Py_IDENTIFIER(_type_);
./Modules/_ctypes/_ctypes.c:1494:_Py_IDENTIFIER(_type_);
./Modules/_ctypes/_ctypes.c:2071:_Py_IDENTIFIER(_type_);

./Modules/_ctypes/_ctypes.c:1692:_Py_IDENTIFIER(_as_parameter_);
./Modules/_ctypes/_ctypes.c:1759:_Py_IDENTIFIER(_as_parameter_);
./Modules/_ctypes/_ctypes.c:1826:_Py_IDENTIFIER(_as_parameter_);
./Modules/_ctypes/_ctypes.c:2256:_Py_IDENTIFIER(_as_parameter_);

./Modules/_ctypes/_ctypes.c:2474:_Py_IDENTIFIER(_check_retval_);
./Modules/_ctypes/_ctypes.c:3280:_Py_IDENTIFIER(_check_retval_);

./Modules/_pickle.c:3560:_Py_IDENTIFIER(__name__);
./Modules/_pickle.c:3979:_Py_IDENTIFIER(__name__);

./Modules/_pickle.c:4042:_Py_IDENTIFIER(__new__);
./Modules/_pickle.c:5771:_Py_IDENTIFIER(__new__);

./Python/ceval.c:5058:_Py_IDENTIFIER(__name__);
./Python/ceval.c:5134:_Py_IDENTIFIER(__name__);

./Python/import.c:386:_Py_IDENTIFIER(__spec__);
./Python/import.c:1569:_Py_IDENTIFIER(__spec__);

./Python/import.c:1571:_Py_IDENTIFIER(__path__);
./Python/import.c:1933:_Py_IDENTIFIER(__path__);

./Python/_warnings.c:487:_Py_IDENTIFIER(__name__);
./Python/_warnings.c:821:_Py_IDENTIFIER(__name__);
./Python/_warnings.c:972:_Py_IDENTIFIER(__name__);

./Python/errors.c:1012:_Py_IDENTIFIER(__module__);
./Python/errors.c:1238:_Py_IDENTIFIER(__module__);

./Objects/bytesobject.c:546:_Py_IDENTIFIER(__bytes__);
./Objects/bytesobject.c:2488:_Py_IDENTIFIER(__bytes__);

./Objects/moduleobject.c:61:_Py_IDENTIFIER(__name__);
./Objects/moduleobject.c:488:_Py_IDENTIFIER(__name__);
./Objects/moduleobject.c:741:_Py_IDENTIFIER(__name__);

./Objects/moduleobject.c:62:_Py_IDENTIFIER(__doc__);
./Objects/moduleobject.c:461:_Py_IDENTIFIER(__doc__);

./Objects/moduleobject.c:65:_Py_IDENTIFIER(__spec__);
./Objects/moduleobject.c:744:_Py_IDENTIFIER(__spec__);

./Objects/iterobject.c:107:_Py_IDENTIFIER(iter);
./Objects/iterobject.c:247:_Py_IDENTIFIER(iter);

./Objects/rangeobject.c:760:_Py_IDENTIFIER(iter);
./Objects/rangeobject.c:918:_Py_IDENTIFIER(iter);

./Objects/descrobject.c:574:_Py_IDENTIFIER(getattr);
./Objects/descrobject.c:1243:_Py_IDENTIFIER(getattr);

./Objects/odictobject.c:899:_Py_IDENTIFIER(items);
./Objects/odictobject.c:1378:_Py_IDENTIFIER(items);
./Objects/odictobject.c:2198:_Py_IDENTIFIER(items);

./Objects/fileobject.c:35:_Py_IDENTIFIER(open);
./Objects/fileobject.c:550:_Py_IDENTIFIER(open);


./Objects/typeobject.c:312:_Py_IDENTIFIER(mro);
./Objects/typeobject.c:1893:_Py_IDENTIFIER(mro);

--
components: Interpreter Core
messages: 360966
nosy: shihai1991
priority: normal
severity: normal
status: open
title: Merge duplicated _Py_IDENTIFIER identifiers in C code
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39486] bug in %-formatting in Python, related to escaped %-characters

2020-01-29 Thread Carl Friedrich Bolz-Tereick


New submission from Carl Friedrich Bolz-Tereick :

The following behaviour of %-formatting changed between Python3.6 and 
Python3.7, and is in my opinion a bug that was introduced.

So far, it has been possible to add conversion flags to a conversion specifier 
in %-formatting, even if the conversion is '%' (meaning a literal % is emitted 
and no argument consumed).

Eg this works in Python3.6:

 "%+%abc% %" % ()
'%abc%'

The conversion flags '+' and ' ' are ignored.

Was it discussed and documented anywhere that this is now an error? Because 
Python3.7 has the following strange behaviour instead:

>>> "%+%abc% %" % ()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: not enough arguments for format string

That error message is just confusing, because the amount of arguments is not 
the problem here. If I pass a dict (thus making the number of arguments 
irrelevant) I get instead:

>>> "%+%abc% %" % {}
Traceback (most recent call last):
  File "", line 1, in 
ValueError: unsupported format character '%' (0x25) at index 2

(also a confusing message, because '%' is a perfectly fine format character)

In my opinion this behaviour should either be reverted to how Python3.6 worked, 
or the new restrictions should be documented and the error messages improved.

--
messages: 360965
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: bug in %-formatting in Python, related to escaped %-characters
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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x: Linux VFS/XFS bug

2020-01-29 Thread miss-islington


miss-islington  added the comment:


New changeset 2b675f0c8fd96f61977f6dc636f44fbd5587b6b3 by Miss Islington (bot) 
in branch '3.8':
bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)
https://github.com/python/cpython/commit/2b675f0c8fd96f61977f6dc636f44fbd5587b6b3


--
nosy: +miss-islington

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x: Linux VFS/XFS bug

2020-01-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17630
pull_request: https://github.com/python/cpython/pull/18253

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x: Linux VFS/XFS bug

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3cb49b62e61208efcefbc04414e769fc173f205d by Victor Stinner in 
branch 'master':
bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)
https://github.com/python/cpython/commit/3cb49b62e61208efcefbc04414e769fc173f205d


--

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Carl Friedrich Bolz-Tereick


Change by Carl Friedrich Bolz-Tereick :


--
keywords: +patch
pull_requests: +17629
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18252

___
Python tracker 

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



[issue39483] Proposial add loop parametr to run in asyncio

2020-01-29 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

A client that creates a loop implicitly in the constructor is a weird design 
from my perspective.

You are free to use it, sure -- but please let us keep the freedom to not 
support such corner cases by asyncio.run()

Sorry, I don't know the telethon library good enough to suggest the best 
workaround.

--

___
Python tracker 

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



[issue39485] Bug in mock running on PyPy3

2020-01-29 Thread Carl Friedrich Bolz-Tereick


New submission from Carl Friedrich Bolz-Tereick :

One of the new-in-3.8 tests for unittest.mock, 
test_spec_has_descriptor_returning_function, is failing on PyPy. This exposes a 
bug in unittest.mock. The bug is most noticeable on PyPy, where it can be 
triggered by simply writing a slightly weird descriptor (CrazyDescriptor in the 
test). Getting it to trigger on CPython would be possible too, by implementing 
the same descriptor in C, but I did not actually do that.

The relevant part of the test looks like this:

from unittest.mock import create_autospec

class CrazyDescriptor(object):
def __get__(self, obj, type_):
if obj is None:
return lambda x: None

class MyClass(object):

some_attr = CrazyDescriptor()

mock = create_autospec(MyClass)
mock.some_attr(1)

On CPython this just works, on PyPy it fails with:

Traceback (most recent call last):
  File "x.py", line 13, in 
mock.some_attr(1)
  File 
"/home/cfbolz/bin/.pyenv/versions/pypy3.6-7.2.0/lib-python/3/unittest/mock.py", 
line 938, in __call__
_mock_self._mock_check_sig(*args, **kwargs)
  File 
"/home/cfbolz/bin/.pyenv/versions/pypy3.6-7.2.0/lib-python/3/unittest/mock.py", 
line 101, in checksig
sig.bind(*args, **kwargs)
  File 
"/home/cfbolz/bin/.pyenv/versions/pypy3.6-7.2.0/lib-python/3/inspect.py", line 
3034, in bind
return args[0]._bind(args[1:], kwargs)
  File 
"/home/cfbolz/bin/.pyenv/versions/pypy3.6-7.2.0/lib-python/3/inspect.py", line 
2955, in _bind
raise TypeError('too many positional arguments') from None
TypeError: too many positional arguments

The reason for this problem is that mock deduced that MyClass.some_attr is a 
method on PyPy. Since mock thinks the lambda returned by the descriptor is a 
method, it adds self as an argument, which leads to the TypeError.

Checking whether something is a method is done by _must_skip in mock.py. The 
relevant condition is this one:

elif isinstance(getattr(result, '__get__', None), MethodWrapperTypes):
# Normal method => skip if looked up on type
# (if looked up on instance, self is already skipped)
return is_type
else:
return False

MethodWrapperTypes is defined as:

MethodWrapperTypes = (
type(ANY.__eq__.__get__),
)

which is just types.MethodType on PyPy, because there is no such thing as a 
method wrapper (the builtin types look pretty much like python-defined types in 
PyPy).

On PyPy the condition isinstance(getattr...) is thus True for all descriptors! 
so as soon as result has a __get__, it counts as a method, even in the above 
case where it's a custom descriptor.


Now even on CPython the condition makes no sense to me. It would be True for a 
C-defined version of CrazyDescriptor, it's just not a good way to check whether 
result is a method.

I would propose to replace the condition with the much more straightforward 
check:

elif isinstance(result, FunctionTypes):
...

something is a method if it's a function on the class. Doing that change makes 
the test pass on PyPy, and doesn't introduce any test failures on CPython 
either.

Will open a pull request.

--
messages: 360961
nosy: Carl.Friedrich.Bolz, cjw296
priority: normal
severity: normal
status: open
title: Bug in mock running on PyPy3

___
Python tracker 

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



[issue39483] Proposial add loop parametr to run in asyncio

2020-01-29 Thread Андрей Казанцев

Андрей Казанцев  added the comment:

I create the client object in `bot` file. If I import it then it creates loop 
when will import and then when I run it I will get errors attaching to a 
different loop. Another way to use `import` statement in main. This is blocking 
code. What to choose?

--

___
Python tracker 

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



[issue39483] Proposial add loop parametr to run in asyncio

2020-01-29 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

-1.
I rather suggest updating telethon example in the following matter:

async with main():
with TelegramClient('anon', api_id, api_hash) as client:
await client.send_message('me', 'Hello, myself!')

You PR brings more problems than fixes: the loop is closed after the first 
usage, the next call with the same loop fails.
I don't think that we should support such tricky mode.

--

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-01-29 Thread Vincent Michel


New submission from Vincent Michel :

On windows, the timestamps produced by time.time() often end up being equal 
because of the 15 ms resolution:

>>> time.time(), time.time()
(1580301469.6875124, 1580301469.6875124)

The problem I noticed is that a value produced by time_ns() might end up being 
higher then a value produced time() even though time_ns() was called before:

>>> a, b = time.time_ns(), time.time()
>>> a, b
(1580301619906185300, 1580301619.9061852)
>>> a / 10**9 <= b
False

This break in causality can lead to very obscure bugs since timestamps are 
often compared to one another. Note that those timestamps can also come from 
non-python sources, i.e a C program using `GetSystemTimeAsFileTime`.

This problem seems to be related to the conversion `_PyTime_AsSecondsDouble`:
https://github.com/python/cpython/blob/f1c19031fd5f4cf6faad539e30796b42954527db/Python/pytime.c#L460-L461

# Float produced by `time.time()`
>>> b.hex()
'0x1.78c5f4cf9fef0p+30'
# Basically what `_PyTime_AsSecondsDouble` does:
>>> (float(a) / 10**9).hex()
'0x1.78c5f4cf9fef0p+30'
# What I would expect from `time.time()`
>>> (a / 10**9).hex()
'0x1.78c5f4cf9fef1p+30'

However I don't know if this would be enough to fix all causality issues since, 
as Tim Peters noted in another thread:

> Just noting for the record that a C double (time.time() result) isn't quite 
> enough to hold a full-precision Windows time regardless

(https://bugs.python.org/issue19738#msg204112)

--
components: Library (Lib)
messages: 360958
nosy: vxgmichel
priority: normal
severity: normal
status: open
title: time_ns() and time() cannot be compared on windows
type: behavior
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



[issue39483] Proposial add loop parametr to run in asyncio

2020-01-29 Thread Андрей Казанцев

Change by Андрей Казанцев :


--
keywords: +patch
pull_requests: +17627
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18248

___
Python tracker 

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



[issue39483] Proposial add loop parametr to run in asyncio

2020-01-29 Thread Андрей Казанцев

New submission from Андрей Казанцев :

Sometimes need get loop from another place and run corutine in it. For example 
when use teleton lib. Example from this lib 
https://docs.telethon.dev/en/latest/basic/signing-in.html#id2 suggests using 
```client.loop.run_until_complete``` but it's not handle errors like in run 
method.

--
components: asyncio
messages: 360957
nosy: asvetlov, heckad, yselivanov
priority: normal
severity: normal
status: open
title: Proposial add loop parametr to run in asyncio
versions: Python 3.9

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x: Linux VFS/XFS bug

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

The kernel bug is now tracked at 
https://bugzilla.redhat.com/show_bug.cgi?id=1795576

I wrote PR 18247 to skip the test.

I suggest to leave this issue is open until the kernel is fixed: until the test 
is no longer skipped.

--
title: test_zipfile: test_add_file_after_2107() sometimes fails on Fedora 
Rawhide 3.x -> test_zipfile: test_add_file_after_2107() sometimes fails on 
Fedora Rawhide 3.x: Linux VFS/XFS bug

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x

2020-01-29 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +17626
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18247

___
Python tracker 

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



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2020-01-29 Thread miss-islington


miss-islington  added the comment:


New changeset 526523c19322169a7f7507d9da291053df979412 by Miss Islington (bot) 
in branch '3.8':
bpo-39153: Clarify C API *SetItem refcounting semantics (GH-18220)
https://github.com/python/cpython/commit/526523c19322169a7f7507d9da291053df979412


--
nosy: +miss-islington

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

I managed to reproduce the issue on Fedora 31 on a XFS filesystem:

$ touch testfn
$ strace -o trace python3 -c 'import os; os.utime("testfn", (4386268800, 
4386268800))'
$ grep ^utimensat trace
utimensat(AT_FDCWD, "testfn", [{tv_sec=4386268800, tv_nsec=0} /* 
2108-12-30T01:00:00+0100 */, {tv_sec=4386268800, tv_nsec=0} /* 
2108-12-30T01:00:00+0100 */], 0) = 0
$ stat testfn
(...)
Modify: 2038-01-19 04:14:07.0 +0100
(...)

It looks like a Linux kernel issue in the XFS filesystem: I don't think that 
mtime should be *silently* truncated to 2147483647.

--

___
Python tracker 

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



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2020-01-29 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset e1e80002e28e1055f399a20918c49d50d093709e by Joannah Nanjekye in 
branch 'master':
bpo-39153: Clarify C API *SetItem refcounting semantics (GH-18220)
https://github.com/python/cpython/commit/e1e80002e28e1055f399a20918c49d50d093709e


--

___
Python tracker 

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



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2020-01-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17625
pull_request: https://github.com/python/cpython/pull/18246

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x

2020-01-29 Thread Florian Weimer


Florian Weimer  added the comment:

I believe you might be observing an XFS limitation in combination with a Linux 
VFS bug.

On disk, XFS only supports 32-bit timestamps:

typedef struct xfs_timestamp {
__be32  t_sec;  /* timestamp seconds */
__be32  t_nsec; /* timestamp nanoseconds */
} xfs_timestamp_t;

This is on the roadmap being fixed.

However, the Linux VFS code does not appear to know about this. It caches the 
full 64-bit value. You only see the truncated value if it is read back from 
disk:

# touch -t 01020304 /tmp/t
# ls -l /tmp/t
-rw-r--r--. 1 root root 0 Jan  2   /tmp/t
# echo 3 > /proc/sys/vm/drop_caches 
# ls -l /tmp/t
-rw-r--r--. 1 root root 0 Oct 19  1949 /tmp/t

This is a bug in the Linux VFS layer.

--
nosy: +fweimer

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

I failed to reproduce the bug on 3 machines.

My x86-64 Fedora VM:

* Linux 5.5.0-0.rc6.git3.1.fc32.x86_64
* glibc-2.30.9000-31.fc32.x86_64
* gcc-10.0.1-0.5.fc32.x86_64
* utimensat() available
* I tested ext4 (/home) and tmpfs (/tmp)

ppc64le mock:

* Linux 5.4.8-200.fc31.ppc64le (kernel of the Fedora 31 host)
* glibc-2.30.9000-31.fc32.ppc64le
* gcc-10.0.1-0.5.fc32.ppc64le
* I tested ext4 (/home) and tmpfs (/tmp)

s390x devel machine:

* Linux 5.5.0-0.rc6.git3.1.fc32.s390x
* glibc-2.30.9000-31.fc32.s390x
* gcc-10.0.1-0.5.fc32.s390x
* I tested nfs4 (/home) and tmpfs (/tmp)

--

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

Next question: does the issue come from the glibc or the filesystem? Attached 
mtime.c should ease debug. If you reproduce the issue, please test different 
filesystem and report which filesystems you tested.

To detect the filesystem used by a directory, I'm using df to find the mount 
point (ex: "/home") and then mount to get the filesystem:

$ df .
Filesystem  Size  Used Avail Use% Mounted on
/dev/nvme0n1p3  461G  368G   93G  80% /home

$ mount|grep /home
/dev/nvme0n1p3 on /home type btrfs 
(rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home)

=> btrfs here

--

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

Summary:

* test_zipfile.test_add_file_after_2107() fails on Fedora Rawhide 3.x
* Bug seen on Python 3.8 and Python 3.9
* Bug seen on s390x and x86-64 architectures
* It seems like the bug occurs in os.utime() with atime=mtime=4386268800 => 
stat returns mtime=2147483647
* It may be a recent change in the glibc to workaround year 2038 bug

Failure on x86-64 Fedora Rawhide, on Fedora Koji build server:

* https://koji.fedoraproject.org/koji/taskinfo?taskID=40870460
* Linux 5.4.8-200.fc31.x86_64
* glibc 2.30.9000
* gcc (GCC) 10.0.1 20200121 (Red Hat 10.0.1-0.4)
* utimensat() available

Failure on "s390x Fedora Rawhide 3.x" buildbot worker:

* https://buildbot.python.org/all/#/builders/323/builds/27
* Linux 5.5.0-0.rc6.git3.1.fc32.s390x
* glibc 2.30.9000
* gcc (GCC) 10.0.1 20200121 (Red Hat 10.0.1-0.4)
* utimensat() available

--

___
Python tracker 

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



[issue39460] test_zipfile: test_add_file_after_2107() sometimes fails on Fedora Rawhide 3.x

2020-01-29 Thread STINNER Victor


STINNER Victor  added the comment:

> I failed to reproduce the issue on s390x Fedora Rawhide, Linux kernel 
> 5.5.0-0.rc4.git2.1.fc32.s390x, glibc-2.30.9000-31.fc32.s390x.

I still cannot reproduce after a "dnf upgrade -y":

* Linux 5.5.0-0.rc6.git3.1.fc32.s390x
* glibc-2.30.9000-31.fc32.s390x

I tested attached mtime.c and Python test_add_file_after_2107() on nfs and 
tmpfs filesystems.

The s390x Fedora Rawhide 3.x buildbot worker where the bug occurs uses the same 
Linux kernel (5.5.0-0.rc6.git3.1.fc32.s390x) and it looks like the same glibc 
version (glibc 2.30.9000). Checking "rpm -q glibc" would say if it's exactly 
the same Fedora package.

David: what is the GCC version? (rpm -q gcc)

--

___
Python tracker 

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



  1   2   >