[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2017-12-01 Thread Martin Panter

Martin Panter  added the comment:

Michael Felt: if you still want the code compatible with Python 2 and 3 (and 
others are happy with that), I suggest documenting that in a code comment.

--

___
Python tracker 

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



[issue32176] Zero argument super is broken in 3.6 for methods with a hacked __class__ cell

2017-12-01 Thread Nick Coghlan

Nick Coghlan  added the comment:

Given that, I'd say the way to cleanest way to fix this would be to remove 
these lines from "compute_code_flags" in compile.c:

if (!PyDict_GET_SIZE(c->u->u_freevars) &&
!PyDict_GET_SIZE(c->u->u_cellvars)) {
flags |= CO_NOFREE;
}

and replace them with a check like the following in PyCode_New just after we 
ensure the Unicode string for the filename is ready:

if (!PyTuple_GET_SIZE(freevars) &&
!PyTuple_GET_SIZE(cellvars)) {
flags |= CO_NOFREE;
}

That way CO_NOFREE will be set only when appropriate regardless of how the code 
object is created, rather than relying on the caller to set it correctly.

--

___
Python tracker 

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



[issue32173] linecache.py add lazycache to __all__ and use dict.clear to clear the cache

2017-12-01 Thread Lisa Roach

Lisa Roach  added the comment:

I think these changes look good, ganziqim has real code improvements (in the 
form of adding lazycache to __all__ and using clear() in clearchache), as well 
as improving the code formatting for readability.

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4581

___
Python tracker 

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



[issue32085] [Security] A New Era of SSRF - Exploiting URL Parser in Trending Programming Languages!

2017-12-01 Thread Martin Panter

Martin Panter  added the comment:

Issue 32185 proposes to stop sending IP addresses in the TLS SNI protocol. 
Maybe this will help; it depends if it will catch IP address strings with with 
whitespace or if there are other ways to inject invalid hostnames.

--
dependencies: +SSLContext.wrap_socket sends SNI Extension when server_hostname 
is IP

___
Python tracker 

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



[issue32188] ImpImporter.find_modules removes symlinks in paths

2017-12-01 Thread Henk-Jaap Wagenaar

Change by Henk-Jaap Wagenaar :


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

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2017-12-01 Thread Ned Deily

Ned Deily  added the comment:

(See also msg307413 in duplicate Issue32195 for more discussion.)

--
nosy: +ned.deily

___
Python tracker 

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



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Ned Deily

Ned Deily  added the comment:

> Isn't this a duplicate of issue 13305?

Looks like it, thanks, though I think the analysis still applies.  Closing as 
duplicate.

--
resolution: not a bug -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> datetime.strftime("%Y") not consistent for years < 1000

___
Python tracker 

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



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Isn't this a duplicate of issue 13305?

--
status: pending -> open

___
Python tracker 

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



[issue32176] Zero argument super is broken in 3.6 for methods with a hacked __class__ cell

2017-12-01 Thread Dan Snider

Dan Snider  added the comment:

So while CO_NOFREE is set in all versions with the example code, it appears 
only python 3.6 recognizes that flag and disallows the accessing of the 
__class__ cell. In this case the error message is bad because it implies that 
the __class__ cell is the wrong type. Disabling the flag when creating the code 
objects allows the above code to work.

--

___
Python tracker 

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



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Ned Deily

Ned Deily  added the comment:

As documented in the Python Library Reference: "The full set of format codes 
supported varies across platforms, because Python calls the platform C 
library’s strftime() function, and platform variations are common. To see the 
full set of format codes supported on your platform, consult the strftime(3) 
documentation."

And this appears to be one of those differences, presumably another GNU libc vs 
BSD one, as I see the same behavior as macOS on the FreeBSD system I have 
available.

The Open Group 2008 documentation for the strftime C interface discusses this 
problem a bit here 
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html):

"The %Y conversion specification to strftime() was frequently assumed to be a 
four-digit year, but the ISO C standard does not specify that %Y is restricted 
to any subset of allowed values from the tm_year field. Similarly, the %C 
conversion specification was assumed to be a two-digit field and the first part 
of the output from the %F conversion specification was assumed to be a 
four-digit field. With tm_year being a signed 32 or more-bit int and with many 
current implementations supporting 64-bit time_t types in one or more 
programming environments, these assumptions are clearly wrong.

POSIX.1-2008 now allows the format specifications %0xC, %0xF, %0xG, and %0xY 
(where 'x' is a string of decimal digits used to specify printing and scanning 
of a string of x decimal digits) with leading zero fill characters. Allowing 
applications to set the field width enables them to agree on the number of 
digits to be printed and scanned in the ISO 8601:2000 standard expanded 
representation of a year (for %F, %G, and %Y ) or all but the last two digits 
of the year (for %C ). This is based on a feature in some versions of GNU 
libc's strftime(). The GNU version allows specifying space, zero, or no-fill 
characters in strftime() format strings, but does not allow any flags to be 
specified in strptime() format strings. These implementations also allow these 
flags to be specified for any numeric field. POSIX.1-2008 only requires the 
zero fill flag ( '0' ) and only requires that it be recognized when processing 
%C, %F, %G, and %Y specifications when a minimum field width is also specified. 
The '0' flag is the only flag needed to produce and scan the ISO 8601:2000 
standard year fields using the extended format forms. POSIX.1-2008 also allows 
applications to specify the same flag and field width specifiers to be used in 
both strftime() and strptime() format strings for symmetry. Systems may provide 
other flag characters and may accept flags in conjunction with conversion 
specifiers other than %C, %F, %G, and %Y; but portable applications cannot 
depend on such extensions."

Experimenting a bit, it seems that the current Linux glibc implementation 
supports the %0xY extension while the current macOS (and other BSD?) do not.

Python 3.6.3 (default, Oct  3 2017, 21:16:13)
[GCC 7.2.0] on linux
>>> datetime.datetime.min.strftime('%Y')
'1'
>>> datetime.datetime.min.strftime('%02Y')
'01'
>>> datetime.datetime.min.strftime('%04Y')
'0001'

Python 3.6.3 (v3.6.3:2c5fed86e0, Oct  3 2017, 00:32:08)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>>> datetime.datetime.min.strftime('%Y')
'0001'
>>> datetime.datetime.min.strftime('%02Y')
'2Y'
>>> datetime.datetime.min.strftime('%04Y')
'4Y'

So I'm afraid there's not much we can do about that without changing Python's 
policy about using the platform's native implementations of date and time 
functions.

Alexander, do you agree?

--
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

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



[issue32162] typing.Generic breaks __init_subclass__

2017-12-01 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue32196] Rewrite plistlib with functional style

2017-12-01 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue32177] spammers mine emails from bugs.python.org

2017-12-01 Thread Brett Cannon

Brett Cannon  added the comment:

We don't sell any information to anyone. If you would like to file a bug to 
have email addresses obfuscated more then the correct place to file that is 
http://psf.upfronthosting.co.za/roundup/meta .

Obviously any help in updating the code would be appreciated as the issue 
tracker predates e.g. bitcoin and this is entirely volunteer-run.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue32188] ImpImporter.find_modules removes symlinks in paths

2017-12-01 Thread Brett Cannon

Brett Cannon  added the comment:

Import itself I don't believe calls os.path.realpath(), so this is probably 
just something pkgutil happens to do.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset e23c06e2b03452c9aaf0dae52296c85e572f9bcd by Victor Stinner in 
branch 'master':
bpo-32030: Fix config_get_program_name() on macOS (#4669)
https://github.com/python/cpython/commit/e23c06e2b03452c9aaf0dae52296c85e572f9bcd


--

___
Python tracker 

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



[issue32173] linecache.py add lazycache to __all__ and use dict.clear to clear the cache

2017-12-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Could you please explain your suggestion ganziqim?

The patch looks like a collection of unrelated changes mostly changing the 
formatting of the code. Usually we don't do such changes. If there is a 
semantical change, it is hidden in a source churn.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32180] bool() vs len() > 0 on lists

2017-12-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm sure adding list.__bool__() will not affect the performance. The real 
source of the difference is explained on the StackOverflow link.

PEP 8 contains a rule for testing the emptiness of a container.

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4578

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 0ea395ae964c9cd0f499e2ef0d0030c971201220 by Victor Stinner in 
branch 'master':
bpo-32030: Add Python/pathconfig.c (#4668)
https://github.com/python/cpython/commit/0ea395ae964c9cd0f499e2ef0d0030c971201220


--

___
Python tracker 

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



[issue32170] Contrary to documentation, ZipFile.extract does not extract timestamps or other metadata

2017-12-01 Thread SilentGhost

Change by SilentGhost :


--
nosy: +alanmcintyre, serhiy.storchaka, twouters

___
Python tracker 

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



[issue32173] linecache.py add lazycache to __all__ and use dict.clear to clear the cache

2017-12-01 Thread Raymond Hettinger

New submission from Raymond Hettinger :

These seems to be reasonable suggestions.

Lisa, would you care to review the patch?

--
assignee:  -> lisroach
nosy: +lisroach, rhettinger

___
Python tracker 

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



[issue32180] bool() vs len() > 0 on lists

2017-12-01 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

ISTM that there isn't a real issue here and the discussions of proper timing 
technique and micro-optimizations are more suitable for StackOverflow.

--
nosy: +rhettinger

___
Python tracker 

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



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue32196] Rewrite plistlib with functional style

2017-12-01 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The proposed PR rewrites the plistlib module using a functional style. This 
speeds up loading and saving plist files at least by 10%. Saving plist files in 
XML format have sped up almost twice.


$ ./python -m timeit -s 'import plistlib; a = list(range(100))' -- 
'plistlib.dumps(a, fmt=plistlib.FMT_XML)'
Unpatched:  1000 loops, best of 5: 228 usec per loop
Patched:1000 loops, best of 5: 204 usec per loop

$ ./python -m timeit -s 'import plistlib; a = list(range(100))' -- 
'plistlib.dumps(a, fmt=plistlib.FMT_BINARY)'
Unpatched:  1000 loops, best of 5: 234 usec per loop
Patched:1000 loops, best of 5: 203 usec per loop

$ ./python -m timeit -s 'import plistlib; a = list(range(100)); p = 
plistlib.dumps(a, fmt=plistlib.FMT_XML)' -- 'plistlib.loads(p)'
Unpatched:  1000 loops, best of 5: 308 usec per loop
Patched:2000 loops, best of 5: 155 usec per loop

$ ./python -m timeit -s 'import plistlib; a = list(range(100)); p = 
plistlib.dumps(a, fmt=plistlib.FMT_BINARY)' -- 'plistlib.loads(p)'
Unpatched:  2000 loops, best of 5: 116 usec per loop
Patched:5000 loops, best of 5: 94.6 usec per loop


$ ./python -m timeit -s 'import plistlib; a = {"a%d" % i: i for i in 
range(100)}' -- 'plistlib.dumps(a, fmt=plistlib.FMT_XML)'
Unpatched:  500 loops, best of 5: 433 usec per loop
Patched:1000 loops, best of 5: 384 usec per loop

$ ./python -m timeit -s 'import plistlib; a = {"a%d" % i: i for i in 
range(100)}' -- 'plistlib.dumps(a, fmt=plistlib.FMT_BINARY)'
Unpatched:  500 loops, best of 5: 616 usec per loop
Patched:500 loops, best of 5: 560 usec per loop

$ ./python -m timeit -s 'import plistlib; a = {"a%d" % i: i for i in 
range(100)}; p = plistlib.dumps(a, fmt=plistlib.FMT_XML)' -- 'plistlib.loads(p)'
Unpatched:  500 loops, best of 5: 578 usec per loop
Patched:1000 loops, best of 5: 308 usec per loop

$ ./python -m timeit -s 'import plistlib; a = {"a%d" % i: i for i in 
range(100)}; p = plistlib.dumps(a, fmt=plistlib.FMT_BINARY)' -- 
'plistlib.loads(p)'
Unpatched:  1000 loops, best of 5: 257 usec per loop
Patched:1000 loops, best of 5: 208 usec per loop

--
components: Library (Lib)
messages: 307404
nosy: ronaldoussoren, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Rewrite plistlib with functional style
type: performance
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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Yuri please do

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4577

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset ebac19dad6263141d5db0a2c923efe049dba99d2 by Victor Stinner in 
branch 'master':
bpo-32030: Don't call _PyPathConfig_Fini() in Py_FinalizeEx() (#4667)
https://github.com/python/cpython/commit/ebac19dad6263141d5db0a2c923efe049dba99d2


--

___
Python tracker 

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



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Dave Challis

Dave Challis  added the comment:

My mistake, it appears to be related to the OS it's running on rather than the 
version (I just happened to test with different versions on different OSes).

On Mac OS X (with 3.6.2):

>>> import datetime
>>> datetime.datetime.min.strftime('%Y')
'0001'

On Linux (with 3.6.2 again):

>>> import datetime
>>> datetime.datetime.min.strftime('%Y')
'1

--

___
Python tracker 

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



[issue25054] Capturing start of line '^'

2017-12-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Could anybody please make review at least of the documentation part? I want to 
merge this before 3.7.0a3 be released.

Initially I was going to backport the part that relates findall(), finditer() 
and sub(). It changes the behavior only in corner cases and I didn't expect it 
can break a real code. But since it broke a pattern in the doctest module, I 
afraid it can break a third-party code.

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4576

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 9ac3d8882712c9675c3d2f9f84af6b5729575cde by Victor Stinner in 
branch 'master':
bpo-32030: Fix Py_GetPath(): init program_name (#4665)
https://github.com/python/cpython/commit/9ac3d8882712c9675c3d2f9f84af6b5729575cde


--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4575

___
Python tracker 

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



[issue30657] [security] CVE-2017-1000158: Unsafe arithmetic in PyString_DecodeEscape

2017-12-01 Thread Miro Hrončok

Change by Miro Hrončok :


--
keywords: +patch
pull_requests: +4574
stage: needs patch -> patch review

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

In what version datetime.strftime with %Y did output leading zeros?

--
nosy: +belopolsky, serhiy.storchaka

___
Python tracker 

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



[issue32171] Inconsistent results for fractional power of -infinity

2017-12-01 Thread Pierre Denis

Pierre Denis  added the comment:

> So this justifies things like `sqrt(-0.0)` giving a zero result (rather than 
> being considered invalid)

Well, I didn’t noticed that the wolf was already in the henhouse! This choice 
seems disputable for me because it is precisely a case where f(-0.0) should NOT 
behave as f(+0.0). The treatment of functions like atan2 and 1/x lets me think 
that the standards tend to follow the results of one-sided limits. So, I’m 
surprised that pow and sqrt functions in IEEE754/C99 standards are treated in 
this unfettered way.

That being said, I’m not involved at all in IEEE/C99 standards; that’s probably 
why I look at this from a pristine point of view. Provided that I accept the 
"axioms" of these standards, the explanations you both give are very 
convincing. I understand well that self-consistency is utmost important, maybe 
even above consistency with mathematical rules. Also, I concede that the 
standards are well-established and considerable efforts have been made to 
validate their different implementations (including Python).

BTW, congratulations to you guys that made the effort to understand the 
standards and rigorously implementing them in Python!

--

___
Python tracker 

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



[issue32192] Provide importlib.util.lazy_import helper function

2017-12-01 Thread Brett Cannon

Brett Cannon  added the comment:

Already planning this as a PyPI package (at least to start). See 
https://notebooks.azure.com/Brett/libraries/di2Btqj7zSI/html/Lazy%20importing.ipynb
 for the design.

--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset b64de46aae148cfab0980e0ad478da7aafc44900 by Victor Stinner in 
branch 'master':
bpo-32030: Cleanup "path config" code (#4663)
https://github.com/python/cpython/commit/b64de46aae148cfab0980e0ad478da7aafc44900


--

___
Python tracker 

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



[issue32030] PEP 432: Rewrite Py_Main()

2017-12-01 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4573

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Yury Selivanov

Yury Selivanov  added the comment:

Andrew, would it be OK if I make a PR?

--

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Yury Selivanov

Yury Selivanov  added the comment:

> How will we guarantee that clients using the old `@coroutine`/`yield from` 
> idiom still work?

They are fully supported now, but we can add a few tests to ensure we won't 
break it.

--

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Guido van Rossum

Guido van Rossum  added the comment:

Yeah, I am in favor of this. How will we guarantee that clients using the old 
`@coroutine`/`yield from` idiom still work? We need to have separate tests for 
that.

--

___
Python tracker 

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



[issue32182] Infinite recursion in email.message.as_string()

2017-12-01 Thread R. David Murray

R. David Murray  added the comment:

It is gh-3488 if you want to try it out.  Feedback welcome.

--

___
Python tracker 

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



[issue32192] Provide importlib.util.lazy_import helper function

2017-12-01 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue32151] -mvenv vs minor python version updates

2017-12-01 Thread Ronald Oussoren

Change by Ronald Oussoren :


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



[issue32151] -mvenv vs minor python version updates

2017-12-01 Thread Ric Anderson

Ric Anderson  added the comment:

well then, I guess y'all can close this ticket

--

___
Python tracker 

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



[issue32195] datetime.strftime with %Y no longer outputs leading zeros

2017-12-01 Thread Dave Challis

New submission from Dave Challis :

Tested in python 3.6.2:

>>> import datetime
>>> datetime.datetime.min.strftime('%Y')
'1'

Expected output:

'0001'

This means that strftime and strptime aren't necessarily symmetric, e.g.:

>>> datetime.datetime.strptime(datetime.datetime.min.strftime('%Y'), '%Y')
ValueError: time data '1' does not match format '%Y'

--
components: Library (Lib)
messages: 307389
nosy: davechallis
priority: normal
severity: normal
status: open
title: datetime.strftime with %Y no longer outputs leading zeros
type: behavior
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



[issue32152] Add pid to .cover filename in lib/trace.py

2017-12-01 Thread Nikhil Hegde

Nikhil Hegde  added the comment:

This is also necessary in a case where two tests (say, a and b) are running in 
parallel. Both tests access the same fileX.py
The coverage for fileX.py will not be accurate to reflect the usage by
tests a and b

--
versions: +Python 3.5, 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



[issue32151] -mvenv vs minor python version updates

2017-12-01 Thread Tzu-ping Chung

Tzu-ping Chung  added the comment:

Hmm, I’m quite sure I have experience that a virtual environment breaks after a 
micro version upgrade on macOS, getting an “image not found” or something 
similar. I’m not using the official released Python, but via Homebrew, so maybe 
this does not happen with the official distribution? I vaguely remember getting 
into a similar problem on Windows as well though…

I don’t have a handy environment set up for reproduction right now. I will try 
to report any problem if I run into this again in the future.

--

___
Python tracker 

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



[issue32182] Infinite recursion in email.message.as_string()

2017-12-01 Thread Silla Rizzoli

Silla Rizzoli  added the comment:

Ok, thanks!
I'm writing a program to convert Outlook for Mac backup files (.olm) into
plain mbox files as a way to teach myself Python (and at the same time
regain control of my email), so I have tens of thousand of emails to test
your new code on, if you feel you need some fedback before releasing it.

Best regards,
Silla

On Thu, Nov 30, 2017 at 5:19 PM, R. David Murray 
wrote:

>
> R. David Murray  added the comment:
>
> This is almost certainly either a duplicate or will be fixed by a PR I
> have pending, that I don't have time to look for right now, that rewrites
> the folder.  I'll try to get to merging that PR soonish, but it might not
> happen before the holidays ;)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue32188] ImpImporter.find_modules removes symlinks in paths

2017-12-01 Thread Henk-Jaap Wagenaar

Henk-Jaap Wagenaar  added the comment:

Ignoring testing code, there is minimal use of os.path.realpath in the stdlib 
(https://github.com/python/cpython/search?utf8=%E2%9C%93&q=%22os.path.realpath%22&type=):

- Lib/platform.py: used before opening a file (works around a cygwin bug)
- Lib/unittest/loader.py: used to compare two paths for equality
- Lib/pkgutil.py: as outlined in this issue
- Lib/pydoc.py: used to determine the directory
- Lib/inspect.py: path and realpath added to caching dictionary

So the question that remains is whether __import__ does this on the hood? I get 
not due to the difference noted in the OP betweein importing and using pkgutil.

--

___
Python tracker 

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



[issue32191] TypeError does not work when function with type hint

2017-12-01 Thread Eric V. Smith

Change by Eric V. Smith :


--
resolution: fixed -> not a bug

___
Python tracker 

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



[issue32194] When creating list of dictionaries and updating datetime objects one by one, all values are set to last one of the list.

2017-12-01 Thread Gareth Rees

Gareth Rees  added the comment:

The behaviour of the * operator (and the associated gotcha) is documented under 
"Common sequence operations" [1]:

Note that items in the sequence s are not copied; they are referenced
multiple times. This often haunts new Python programmers ...

There is also an entry in the FAQ [2]:

replicating a list with * doesn’t create copies, it only creates
references to the existing objects

[1] 
https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range
[2] https://docs.python.org/3/faq/programming.html#faq-multidimensional-list

--
nosy: +g...@garethrees.org
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



[issue32194] When creating list of dictionaries and updating datetime objects one by one, all values are set to last one of the list.

2017-12-01 Thread Dmitry Kazakov

Dmitry Kazakov  added the comment:

This is not a bug in Python. Refer to this page for the explanation: 
https://stackoverflow.com/questions/240178/list-of-lists-changes-reflected-across-sublists-unexpectedly

Basically, [{}]*3 creates a list with three references to the same dictionary.

--
nosy: +vaultah

___
Python tracker 

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



[issue32194] When creating list of dictionaries and updating datetime objects one by one, all values are set to last one of the list.

2017-12-01 Thread Joona Mörsky

New submission from Joona Mörsky :

When creating list of dictionaries and updating datetime objects one by one, 
all values are set to last one of the list.

Ubuntu Linux 4.10.0-40-generic #44~16.04.1-Ubuntu SMP Thu Nov 9 15:37:44 UTC 
2017 x86_64 x86_64 x86_64 GNU/Linux
Python 3.5.2



>>>import datetime

>>>b = datetime.datetime.utcnow()
>>>b = 
>>>b.replace(hour=0,minute=0,second=0,microsecond=0,tzinfo=datetime.timezone.utc)

>>>a = [{}] * 3

>>>for inx in range(3):

...a[inx]['time'] = b + datetime.timedelta(minutes=inx*10)


[{'time': datetime.datetime(2017, 12, 1, 0, 20, tzinfo=datetime.timezone.utc)}, 
{'time': datetime.datetime(2017, 12, 1, 0, 20, tzinfo=datetime.timezone.utc)}, 
{'time': datetime.datetime(2017, 12, 1, 0, 20, tzinfo=datetime.timezone.utc)}]

>>>import datetime

>>>b = datetime.datetime.utcnow()
>>>b = 
>>>b.replace(hour=0,minute=0,second=0,microsecond=0,tzinfo=datetime.timezone.utc)

>>>a = [ ]

>>>for inx in range(3):

...a.append({"time": b + datetime.timedelta(minutes=inx*10)})

[{'time': datetime.datetime(2017, 12, 1, 0, 0, tzinfo=datetime.timezone.utc)}, 
{'time': datetime.datetime(2017, 12, 1, 0, 10, tzinfo=datetime.timezone.utc)}, 
{'time': datetime.datetime(2017, 12, 1, 0, 20, tzinfo=datetime.timezone.utc)}]

--
components: Interpreter Core
messages: 307382
nosy: Joona Mörsky
priority: normal
severity: normal
status: open
title: When creating list of dictionaries and updating datetime objects one by 
one, all values are set to last one of the list.
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-01 Thread Sergey Fedoseev

Sergey Fedoseev  added the comment:

> OS
x86_64 GNU/Linux

> compiler
gcc version 7.2.0 (Debian 7.2.0-16)

> CPU
Architecture:x86_64
CPU op-mode(s):  32-bit, 64-bit
Byte Order:  Little Endian
CPU(s):  4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):   1
NUMA node(s):1
Vendor ID:   GenuineIntel
CPU family:  6
Model:   58
Model name:  Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Stepping:9
CPU MHz: 2494.521
CPU max MHz: 3100,
CPU min MHz: 1200,
BogoMIPS:4989.04
Virtualization:  VT-x
L1d cache:   32K
L1i cache:   32K
L2 cache:256K
L3 cache:3072K
NUMA node0 CPU(s):   0-3
Flags:   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx 
rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology 
nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 
ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave 
avx f16c rdrand lahf_lm cpuid_fault epb tpr_shadow vnmi flexpriority ept vpid 
fsgsbase smep erms xsaveopt dtherm ida arat pln pts

> Do you build 32- or 64-bit Python?
I'm not sure about that, I guess 64 is default on 64 OS?

> Do you build in a debug or release mode?
I tried with --enable-optimizations, --with-pydebug and without any flags. 
Numbers are different, but magnitude of a change is the same.

--

___
Python tracker 

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



[issue16487] Allow ssl certificates to be specified from memory rather than files.

2017-12-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 01/12/2017 à 10:47, Christian Heimes a écrit :
> 
> It doesn't matter for certificates. I guess you also want to load the key 
> from a memory buffer, don't you? That's going to be less secure.

Yes, that's what I meant.

--

___
Python tracker 

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



[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-01 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Yes. And I can't reproduce a slowdown with a simplified a2b_qp(). Maybe this 
depends on the compiler and on the CPU. What are your OS, compiler and CPU? Do 
you build 32- or 64-bit Python? Do you build in a debug or release mode?

--

___
Python tracker 

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



[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-01 Thread Sergey Fedoseev

Sergey Fedoseev  added the comment:

Serhiy, did you use the same benchmark as mentioned here?

--

___
Python tracker 

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



[issue16487] Allow ssl certificates to be specified from memory rather than files.

2017-12-01 Thread Christian Heimes

Christian Heimes  added the comment:

It doesn't matter for certificates. I guess you also want to load the key from 
a memory buffer, don't you? That's going to be less secure.

--

___
Python tracker 

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



[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors

2017-12-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the heads up Rob!

--

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Andrew Svetlov

Change by Andrew Svetlov :


--
type:  -> enhancement

___
Python tracker 

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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Andrew Svetlov

New submission from Andrew Svetlov :

As discussed several times before we need to convert `@coroutine` / `yield 
from` to async/await.

All existing functionality should keep working (like yielding from new style 
coroutine and `with (yield from lock)`.

We could deprecate the later though.

The change should be huge but there is no alternative, keeping `yield from` in 
stdlib looks uglier and uglier every year.

Unittests should be changed as well (keeping several `yield from` for checking 
backward compatibility is Ok).


Opinions?

--
assignee: asvetlov
components: Library (Lib), asyncio
messages: 307375
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Convert asyncio to async/await
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



[issue32193] Convert asyncio to async/await

2017-12-01 Thread Andrew Svetlov

Change by Andrew Svetlov :


--
nosy: +gvanrossum, vstinner

___
Python tracker 

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



[issue30581] os.cpu_count() returns wrong number of processors on system with > 64 logical processors

2017-12-01 Thread robbuckley

robbuckley  added the comment:

hi, 
as the reporter i just want to say this is working for me with 3.6.3. 

Regarding https://bugs.python.org/issue30581#msg301150, I take your point that 
a lot of multiprocessing using the standard libraries may not benefit, as 
processes may be restricted to the processor group of the parent process 
(python). 

For my use case it works well: I launch a queue of blocking jobs, using a 
thread pool. Each thread launches 1 jobsubprocess.subprocess.run(), where the 
thread pool size is equal to number of processors reported by os.cpu_count(). 
Since the OS controls the scheduling in this case, it works perfectly well with 
2 processor groups. 

thanks :-)

--

___
Python tracker 

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



[issue16487] Allow ssl certificates to be specified from memory rather than files.

2017-12-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Is it possible to have a single C function that loads the certificates
from memory, or would that make the file-loading case less secure?

Le 01/12/2017 à 10:25, Christian Heimes a écrit :
> 
> Christian Heimes  added the comment:
> 
> Correct, PEP 543 won't land in Python 3.7 because neither me nor Cory have 
> the resources to land it. However I want all changes and new additions to the 
> SSL module to follow PEP 543 so I can provide a PEP 543-compatible interface 
> in the near future (3.8 or 3.9). We need a proper certificate class anyway to 
> address other issues and feature requests. I don't want to have three ways to 
> load certificates, especially when it involves more C code.
> 
> --
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue16487] Allow ssl certificates to be specified from memory rather than files.

2017-12-01 Thread Christian Heimes

Christian Heimes  added the comment:

Correct, PEP 543 won't land in Python 3.7 because neither me nor Cory have the 
resources to land it. However I want all changes and new additions to the SSL 
module to follow PEP 543 so I can provide a PEP 543-compatible interface in the 
near future (3.8 or 3.9). We need a proper certificate class anyway to address 
other issues and feature requests. I don't want to have three ways to load 
certificates, especially when it involves more C code.

--

___
Python tracker 

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



[issue32151] -mvenv vs minor python version updates

2017-12-01 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

The virtualenv (both using venv and using the third party library virtualenv) 
still relies on most of the python installation outside of the virtualenv, in 
particular the stdlib extensions. Those are not guartanteed to be binary 
compatible between feature releases (3.5 -> 3.6), but should be compatible with 
bug fix releases (3.6.1 -> 3.6.2).

Micro updates should work without breaking virtual environments, the venv 
doesn't include links to 3th party libraries by default (including openssl and 
the like). Doing larger upgrades of dependencies in micro updates can still 
break stuff though, but there's not much that the CPython team can do about 
that (unless we're doing incompatible updates of dependencies in the python.org 
installers).

--

___
Python tracker 

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



[issue32192] Provide importlib.util.lazy_import helper function

2017-12-01 Thread Nick Coghlan

Change by Nick Coghlan :


--
nosy: +brett.cannon, eric.snow
stage:  -> needs patch
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



[issue32192] Provide importlib.util.lazy_import helper function

2017-12-01 Thread Nick Coghlan

New submission from Nick Coghlan :

While importlib provides all the *pieces* to implement lazy imports, we don't 
actually provide a clear way of chaining them together into a lazy import 
operation. Without any error checking, that looks like:

import sys
import importlib.util
def lazy_import(name):
spec = importlib.util.find_spec(name)
loader = importlib.util.LazyLoader(spec.loader)
spec.loader = loader
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
loader.exec_module(module)
return module

>>> lazy_typing = lazy_import("typing")
>>> lazy_typing.TYPE_CHECKING
False

I'm thinking it may make sense to just provide a robust implementation of that, 
and accept that it may lead to some bug reports that are closed with "You need 
to fix the module you're loading to be compatible with lazy imports"

--
messages: 307370
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Provide importlib.util.lazy_import helper function

___
Python tracker 

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