[issue30455] Generate all tokens related code and docs from Grammar/Tokens

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If there are no objections I am going to merge PR 10370 in few days.

--

___
Python tracker 

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



[issue5438] test_bigmem.test_from_2G_generator uses more memory than expected

2018-12-19 Thread miss-islington


miss-islington  added the comment:


New changeset a26201cd8ef17dc81431f768846291c9f4337550 by Miss Islington (bot) 
in branch '3.7':
bpo-5438: Update memory requirements and optimize test_bigmem.py. (GH-11123)
https://github.com/python/cpython/commit/a26201cd8ef17dc81431f768846291c9f4337550


--
nosy: +miss-islington

___
Python tracker 

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



[issue22831] Use "with" to avoid possible fd leaks

2018-12-19 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Éric, could you please take a look at PR 10921?

--

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread miss-islington


miss-islington  added the comment:


New changeset 73fc14d1f8441aef5ee03be627c63e74a6d915d6 by Miss Islington (bot) 
in branch '3.7':
bpo-18085: Update refcounts.dat. (GH-11247)
https://github.com/python/cpython/commit/73fc14d1f8441aef5ee03be627c63e74a6d915d6


--
nosy: +miss-islington

___
Python tracker 

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



[issue5438] test_bigmem.test_from_2G_generator uses more memory than expected

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b13a20f50789e153c18ed8efb4fbc5eecc50f2cd by Serhiy Storchaka in 
branch 'master':
bpo-5438: Update memory requirements and optimize test_bigmem.py. (GH-11123)
https://github.com/python/cpython/commit/b13a20f50789e153c18ed8efb4fbc5eecc50f2cd


--

___
Python tracker 

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



[issue5438] test_bigmem.test_from_2G_generator uses more memory than expected

2018-12-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10489

___
Python tracker 

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



[issue14094] ntpath.realpath() should use GetFinalPathNameByHandle()

2018-12-19 Thread Vladimir Matveev


Change by Vladimir Matveev :


--
keywords: +patch
pull_requests: +10488
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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10487

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 83dd4e87a62311cfea5fdd37e8a945b6b07bccee by Serhiy Storchaka in 
branch 'master':
bpo-18085: Update refcounts.dat. (GH-11247)
https://github.com/python/cpython/commit/83dd4e87a62311cfea5fdd37e8a945b6b07bccee


--

___
Python tracker 

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



[issue35538] splitext does not seems to handle filepath ending in .

2018-12-19 Thread Devika Sondhi


Devika Sondhi  added the comment:

Linux (unlike Windows) allows naming a file with a trailing dot. The issue with 
file name such as '.blah.' is that it does not have an extension and one would 
expect the base-name without extension to be returned as '.blah.' and not as 
'.blah'
splitext returns ('.blah','.')

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

___
Python tracker 

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



[issue35542] stack exhaustion in 3.6.7

2018-12-19 Thread shuoz


shuoz  added the comment:

thank you for your reply.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: security -> crash

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I did not find the references in the text I remembered, but found 2 more 
involving the menu section.

--

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +10486

___
Python tracker 

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



[issue35541] CLI error when .python_history contains unicode characters

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue34162] idlelib/NEWS.txt for 3.8.0 (and backports)

2018-12-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 93f5694bb0c147ae48da492d6eb627562f8d by Terry Jan Reedy in 
branch '3.7':
[3.7] bpo-34162: Update idlelib/NEWS.txt to 2018-12-20 (GH-11255) (#11256)
https://github.com/python/cpython/commit/93f5694bb0c147ae48da492d6eb627562f8d


--

___
Python tracker 

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



[issue35541] CLI error when .python_history contains unicode characters

2018-12-19 Thread Eryk Sun


Eryk Sun  added the comment:

pyreadline is a third-party package. Refer to issue 55 at its GitHub repo:

https://github.com/pyreadline/pyreadline/issues/55

--
nosy: +eryksun
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue35542] stack exhaustion in 3.6.7

2018-12-19 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Related older issue : issue1110055

https://docs.python.org/3/library/sys.html#sys.setrecursionlimit

> The highest possible limit is platform-dependent. A user may need to set the 
> limit higher when they have a program that requires deep recursion and a 
> platform that supports a higher limit. This should be done with care, because 
> a too-high limit can lead to a crash.

I think this is a known case where the stack limit is hit depending on the 
operating system before RecursionError can be raised when a higher recursion 
limit is set. On my machine (Mac 10.10.4) this segfaults on 2.7 but raises 
RecurstionError on Python 3.7.1. Increasing the limit to 20 causes segfault 
on 3.7.1.

--
nosy: +xtreak

___
Python tracker 

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



[issue35542] stack exhaustion in 3.6.7

2018-12-19 Thread shuoz


New submission from shuoz :

stack exhaustion in 3.6.7.

in python  3.6.7 set recursive depth 2 will exhaustion stack and get 
Segmentation fault. But this dont happen in python 2.7


```
import sys
sys.setrecursionlimit(2)
def f():
f()
f()
```

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 332183
nosy: shuoz
priority: normal
severity: normal
status: open
title: stack exhaustion in 3.6.7
type: security
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



[issue34162] idlelib/NEWS.txt for 3.8.0 (and backports)

2018-12-19 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +10485

___
Python tracker 

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



[issue35148] cannot activate a venv environment on a Swiss German windows

2018-12-19 Thread Mike Pagel


Mike Pagel  added the comment:

Dear developers on the nosy list: Would it be possible that someone does a 
quick review of my related fix in https://github.com/python/cpython/pull/10696?

It is extremely simple and has minimal side effects, but would relieve us from 
getting this annoying error in the future.

I know this is a minor thing but each time I start a venv in Germany, I am 
reminded of this... :-)

Thanks a lot.

--

___
Python tracker 

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



[issue34271] Please support logging of SSL master secret by env variable SSLKEYLOGFILE

2018-12-19 Thread Dima Tisnek


Dima Tisnek  added the comment:

Perhaps 
https://stackoverflow.com/questions/42332792/chrome-not-firefox-are-not-dumping-to-sslkeylogfile-variable
 is outdated, but it suggests that:

in firefox, this feature os not on by default

in chrome, this feature is not available

I would be vary of "too much magic"... Though I'd use this in development, I 
feel that's a bit risky for desktop apps, production, etc...

--
nosy: +Dima.Tisnek

___
Python tracker 

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



[issue34162] idlelib/NEWS.txt for 3.8.0 (and backports)

2018-12-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 87ec1104b369865c3c41d2d91ac7aee29cfb632e by Terry Jan Reedy in 
branch 'master':
bpo-34162: Update idlelib/NEWS.txt to 2018-12-20. (#11255)
https://github.com/python/cpython/commit/87ec1104b369865c3c41d2d91ac7aee29cfb632e


--

___
Python tracker 

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



[issue35541] CLI error when .python_history contains unicode characters

2018-12-19 Thread Armandas

New submission from Armandas :

OS: Windows 10
Python version: Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC 
v.1915 32 bit (Intel)] on win32

Traceback:
Failed calling sys.__interactivehook__
Traceback (most recent call last):
  File "C:\Users\owner\AppData\Local\Programs\Python\Python37-32\lib\site.py", 
line 439, in register_readline
readline.read_history_file(history)
  File 
"C:\Users\owner\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyreadline\rlmain.py",
 line 165, in read_history_file
self.mode._history.read_history_file(filename)
  File 
"C:\Users\owner\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyreadline\lineeditor\history.py",
 line 82, in read_history_file
for line in open(filename, 'r'):
  File 
"C:\Users\owner\AppData\Local\Programs\Python\Python37-32\lib\encodings\cp1252.py",
 line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2: 
character maps to 

How to reproduce:
On a Windows machine, add the following line to your .python_history:

"あ".isalpha()

I believe the issue stems from the fact that the history file is opened with 
the "default" encoding, which on windows is cp1252.

--
components: Library (Lib)
messages: 332179
nosy: armandas
priority: normal
severity: normal
status: open
title: CLI error when .python_history contains unicode characters
type: behavior
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



[issue35536] Calling built-in locals() and globals() in C++ leads to SystemError

2018-12-19 Thread Никита Сиргиенко

Никита Сиргиенко  added the comment:

I run some Python code before this moment, so I expect, that globals variable 
will be a PyDictObject with results of 'globals()' command: '__name__', 
'__doc__', global variables, etc.

--

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

No more 3.6 backports.

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread miss-islington


miss-islington  added the comment:


New changeset 3f9338312738b4b6d909fa7d5e7bb02f2efc08a5 by Miss Islington (bot) 
in branch '3.7':
bpo-35521: IDLE: Add code context section to docs (GH-11205)
https://github.com/python/cpython/commit/3f9338312738b4b6d909fa7d5e7bb02f2efc08a5


--
nosy: +miss-islington

___
Python tracker 

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



[issue34162] idlelib/NEWS.txt for 3.8.0 (and backports)

2018-12-19 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +10484
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



[issue35536] Calling built-in locals() and globals() in C++ leads to SystemError

2018-12-19 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

What behavior are you expecting? If there isn't any Python code in the 
callback, globals() and locals() are meaningless.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue35526] __future__.barry_as_FLUFL documented as mandatory for Python 3.9

2018-12-19 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Good thing we don't need a barry_as_GUIDO alias.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10483

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 01421bec1e0d25df17599cfa1160adbbcd08e949 by Terry Jan Reedy 
(Cheryl Sabella) in branch 'master':
bpo-35521: IDLE: Add code context section to docs (#11205)
https://github.com/python/cpython/commit/01421bec1e0d25df17599cfa1160adbbcd08e949


--

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10482

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Great.  Since you included half of the other needed ref links in the PR, and I 
mentioned them in the blurb, I am going to include the other half in this PR as 
a followup PR.

--
title: IDLE: Add doc section for Code Conext -> IDLE: Add doc section for Code 
Context and ref links.

___
Python tracker 

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



[issue35530] Counter-intuitive logging API

2018-12-19 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> vinay.sajip

___
Python tracker 

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



[issue35521] IDLE: Add doc section for Code Context and ref links.

2018-12-19 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-19 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith
nosy: +eric.smith

___
Python tracker 

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



[issue17972] inspect module docs omits many functions

2018-12-19 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

issue12317 discusses inspect.getabsfile()

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue35540] dataclasses.asdict breaks with defaultdict fields

2018-12-19 Thread Will T


New submission from Will T :

_asdict_inner attempts to manually recursively deepcopy dicts by calling 
type(obj) with a generator of transformed keyvalue tuples @ 
https://github.com/python/cpython/blob/b2f642ccd2f65d2f3bf77bbaa103dd2bc2733734/Lib/dataclasses.py#L1080
 . defaultdicts are dicts so this runs but unlike other dicts their first arg 
has to be a callable or None:

import collections
import dataclasses as dc

@dc.dataclass()
class C:
d: dict

c = C(collections.defaultdict(lambda: 3, {}))
d = dc.asdict(c)

assert isinstance(d['d'], collections.defaultdict)
assert d['d']['a'] == 3

=>

Traceback (most recent call last):
  File "boom.py", line 9, in 
d = dc.asdict(c)
  File 
"/Users/spinlock/.pyenv/versions/3.7.1/lib/python3.7/dataclasses.py", line 
1019, in asdict
return _asdict_inner(obj, dict_factory)
  File 
"/Users/spinlock/.pyenv/versions/3.7.1/lib/python3.7/dataclasses.py", line 
1026, in _asdict_inner
value = _asdict_inner(getattr(obj, f.name), dict_factory)
  File 
"/Users/spinlock/.pyenv/versions/3.7.1/lib/python3.7/dataclasses.py", line 
1058, in _asdict_inner
for k, v in obj.items())
TypeError: first argument must be callable or None

I understand that it isn't this bit of code's job to support every dict (and 
list etc.) subclass under the sun but given defaultdict is stdlib it's imo 
worth supporting explicitly.

--
components: Library (Lib)
messages: 332166
nosy: wrmsr
priority: normal
severity: normal
status: open
title: dataclasses.asdict breaks with defaultdict fields
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



[issue35539] Cannot properly close terminated process

2018-12-19 Thread Hrvoje Nikšić

New submission from Hrvoje Nikšić :

It seems impossible to correctly close() an asyncio Process on which terminate 
has been invoked. Take the following coroutine:

async def test():
proc = await asyncio.create_subprocess_shell(
"sleep 1", stdout=asyncio.subprocess.PIPE)
proc.terminate()
await proc.wait()

After running it with asyncio.run(), Python prints a warning about "Event loop 
is closed" exception ignored in BaseSubprocessTransport.__del__. The code does 
wait for the process to exit, and neither proc nor proc.stdout have a close() 
method, so the warning seems spurious.

Commenting out proc.terminate() makes the program finish without an exception 
(but then it waits for a full second, of course).

Runnable example attached.

--
components: asyncio
files: terminate.py
messages: 332165
nosy: asvetlov, hniksic, yselivanov
priority: normal
severity: normal
status: open
title: Cannot properly close terminated process
versions: Python 3.7
Added file: https://bugs.python.org/file48008/terminate.py

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 11247 adds more functions and fixes some errors.

--

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests:  -10478

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests:  -10477

___
Python tracker 

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



[issue32077] Documentation: Some Unicode object functions don't indicate whether they return a new reference

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Sorry, I forget about this issue and remembered it only after creating similar 
patch from scratch. PR 11247 is what left from it after merging your patch.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +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



[issue32077] Documentation: Some Unicode object functions don't indicate whether they return a new reference

2018-12-19 Thread miss-islington


miss-islington  added the comment:


New changeset 29d4e309b1b4dfb26d65d83c683002911c066dec by Miss Islington (bot) 
in branch '3.7':
bpo-32077: Update refcounts.dat for Unicode object functions. (GH-11243)
https://github.com/python/cpython/commit/29d4e309b1b4dfb26d65d83c683002911c066dec


--
nosy: +miss-islington

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +10476, 10477
stage:  -> patch review

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +10476, 10477, 10478
stage:  -> patch review

___
Python tracker 

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



[issue18085] Verifying refcounts.dat

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +10476
stage:  -> patch review

___
Python tracker 

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



[issue32077] Documentation: Some Unicode object functions don't indicate whether they return a new reference

2018-12-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10475

___
Python tracker 

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



[issue32077] Documentation: Some Unicode object functions don't indicate whether they return a new reference

2018-12-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10474

___
Python tracker 

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



[issue32077] Documentation: Some Unicode object functions don't indicate whether they return a new reference

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset b2f642ccd2f65d2f3bf77bbaa103dd2bc2733734 by Serhiy Storchaka (Mat 
M) in branch 'master':
bpo-32077: Update refcounts.dat for Unicode object functions. (GH-11243)
https://github.com/python/cpython/commit/b2f642ccd2f65d2f3bf77bbaa103dd2bc2733734


--

___
Python tracker 

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



[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2018-12-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak
versions: +Python 3.7, Python 3.8 -Python 3.3, Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

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



[issue35538] splitext does not seems to handle filepath ending in .

2018-12-19 Thread Matthew Barnett


Matthew Barnett  added the comment:

It always returns the dot.

For example:

>>> posixpath.splitext('.blah.txt')
('.blah', '.txt')

If there's no extension (no dot):

>>> posixpath.splitext('blah')
('blah', '')

Not a bug.

--
nosy: +mrabarnett
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



[issue35538] splitext does not seems to handle filepath ending in .

2018-12-19 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Is this similar to previous discussions about leading and trailing dots ? 
https://bugs.python.org/issue34931#msg328820

--
nosy: +xtreak

___
Python tracker 

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



[issue29081] time.strptime() return wrong result

2018-12-19 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This causes the round trip to be a ValueError. 

./python.exe
Python 3.8.0a0 (heads/master:1dd035954b, Dec 18 2018, 10:12:34)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> value = '2016 51 0'
>>> format = '%Y %W %w'
>>> time.strftime(format, time.strptime('2016 51 0', format)) == value
True
>>> time.strptime('2016 52 0', format)
time.struct_time(tm_year=2017, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=6, tm_yday=367, tm_isdst=-1)
>>> time.strftime(format, time.strptime('2016 52 0', format)) == value
Traceback (most recent call last):
  File "", line 1, in 
ValueError: day of year out of range

On Ruby this causes runtime error

irb(main):005:0> DateTime::strptime("2016 52 0", "%Y %W %w")
Traceback (most recent call last):
3: from /usr/local/bin/irb:11:in `'
2: from (irb):5
1: from (irb):5:in `strptime'
ArgumentError (invalid date)

With C it returns 2016 00 5 on Mac OS 10.10.4 and 2017 00 0 on Ubuntu

#include 
#include 

int main() {
  struct tm ltm = {0};
  char buf[] = "2016 52 0";
  strptime(buf, "%Y %W %w", );
  time_t ptm = mktime();

  printf("tm year %d\n", ltm.tm_year);
  printf("tm yday %d\n", ltm.tm_yday);
  printf("tm wday %d\n", ltm.tm_wday);

  char str[50];
  struct tm *tm_info = localtime();
  strftime(str, 50, "%Y %W %w", tm_info);
  printf("%s\n", str);
}

Output : 

Mac

tm year 116
tm yday 0
tm wday 5
2016 00 5

Ubuntu 

tm year 117
tm yday 0
tm wday 0
2017 00 0

--
nosy: +belopolsky, p-ganssle
versions: +Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2018-12-19 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
nosy: +gregory.p.smith, izbyshev

___
Python tracker 

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



[issue35538] splitext does not seems to handle filepath ending in .

2018-12-19 Thread Devika Sondhi


New submission from Devika Sondhi :

posixpath.splitext('.blah.') returns ('.blah', '.') while the expectation was 
to return an empty extension at the end.

--
messages: 332157
nosy: Devika Sondhi
priority: normal
severity: normal
status: open
title: splitext does not seems to handle filepath ending  in .
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue33460] "..." is used to confusingly indicate many different things in chapter 3

2018-12-19 Thread Lew Kurtz


Lew Kurtz  added the comment:

Removed the ellipses from the examples, so not confused with continuation 
prompt. Is clearer now.

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

___
Python tracker 

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



[issue35257] Avoid leaking linker flags into distutils: add PY_LDFLAGS_NODIST

2018-12-19 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cf10a750f4b50b6775719cfb17bee00bc3a9c60b by Victor Stinner 
(stratakis) in branch 'master':
bpo-35257: Avoid leaking LTO linker flags into distutils (GH-10900)
https://github.com/python/cpython/commit/cf10a750f4b50b6775719cfb17bee00bc3a9c60b


--

___
Python tracker 

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



[issue35535] time.strptime() unexpectedly gives the same result for %U and %W for 2018

2018-12-19 Thread Paul Ganssle


Paul Ganssle  added the comment:

I don't really know what Python was doing in version 2.3, and I don't have 
immediate access to a Python 2.3 interpreter, but at least for %U and %W, 
datetime is calling the platform's `strftime` under the hood, so presumably if 
this is a bug it's a bug in glibc and the other providers of `strftime`.

Digging a bit more, %U and %W appear to be the the same for all Sundays if (and 
only if) the year starts on a Monday:

import calendar
from datetime import datetime
from dateutil import rrule


rr = rrule.rrule(freq=rrule.WEEKLY,
 byweekday=rrule.SU,
 dtstart=datetime(1900, 1, 1),
 until=datetime(2100, 1, 1))

for dt in rr:
is_same = dt.strftime("%U") == dt.strftime("%W")
year_starts_monday = calendar.weekday(dt.year, 1, 1) == 0
assert is_same == year_starts_monday


This seems to be the right behavior, because %U and %W count all days before 
their respective "first day of the week" as "week 0", and week 1 starts with 
the relevant day of the week. If the year starts with Monday, week 1 is  1 
January - 7 January according to %W (year starts on Monday), and week 1 is 7 
January - 13 January according to %U (year starts on Sunday), thus all Sundays 
will be in the same "week number" in both systems.

> %U is supposed to work with the week numbering system common (as I understand 
> it) in North America, where (according to Wikipedia) week 1 begins on a 
> Sunday, and contains both 1 January and the first Saturday of the year. While 
> I am not familiar with that system, Excel 2016 is, and it reports 

The documentation for %U says:

> Week number of the year (Sunday as the first day of the week) as a zero 
> padded decimal number. All days in a new year preceding the first Sunday are 
> considered to be in week 0.

This means that week 1 would only contain the first Saturday of the month and 
January 1st on years that start on Sunday. The Python documentation is 
consistent with the man page for strftime(3): 
http://man7.org/linux/man-pages/man3/strftime.3.html

--
versions: +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



[issue35257] Avoid leaking linker flags into distutils: add PY_LDFLAGS_NODIST

2018-12-19 Thread STINNER Victor


STINNER Victor  added the comment:

PGO+LTO build with PR 10900: I see PGO options (-fprofile-instr-generate then 
-fprofile-instr-use=code.profclangd) and LTO option (-flto) passed to the 
compiler and to the linker, as expected:

$ git clean -fdx
$ ./configure CC=clang --with-lto --prefix /opt/py38 --enable-optimizations
$ sed -i -e 's/^PROFILE_TASK=.*/PROFILE_TASK=-c pass/' Makefile
$ make
...
# compile Python core
clang ... -flto  ... -fprofile-instr-generate ... Modules/main.c
...
# link ./python program
clang -pthread   -flto -g -fprofile-instr-generate -Xlinker -export-dynamic -o 
python Programs/python.o libpython3.8m.a -lpthread -ldl  -lutil -lm   -lm 
...
# compile stdlib C extension
clang ... -flto ... -fprofile-instr-generate ... -c 
/home/vstinner/prog/python/master/Modules/_heapqmodule.c ...
...
rm -f profile-gen-stamp
...
# compile Python core
clang ... -flto ... -fprofile-instr-use=code.profclangd ... -o 
Programs/python.o ./Programs/python.c
...
# link ./python program
clang -pthread   -flto -g  -Xlinker -export-dynamic -o python Programs/python.o 
libpython3.8m.a -lpthread -ldl  -lutil -lm   -lm 
...
# build struct extension
clang ... -flto ... -fprofile-instr-use=code.profclangd ... -c 
/home/vstinner/prog/python/master/Modules/_struct.c -o 
build/temp.linux-x86_64-3.8/home/vstinner/prog/python/master/Modules/_struct.o
warning: no profile data available for file "_struct.c" 
[-Wprofile-instr-unprofiled]
1 warning generated.
clang -pthread -shared -flto -g 
build/temp.linux-x86_64-3.8/home/vstinner/prog/python/master/Modules/_struct.o 
-L/opt/py38/lib -L/usr/local/lib -o 
build/lib.linux-x86_64-3.8/_struct.cpython-38m-x86_64-linux-gnu.so
...

--

___
Python tracker 

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



[issue14094] ntpath.realpath() should use GetFinalPathNameByHandle()

2018-12-19 Thread Vladimir Matveev


Vladimir Matveev  added the comment:

I can give it a try.

--
nosy: +v2m

___
Python tracker 

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



[issue32077] Documentation: Some Unicode object functions don't indicate whether they return a new reference

2018-12-19 Thread Mathew M.


Change by Mathew M. :


--
pull_requests: +10473

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2018-12-19 Thread Joannah Nanjekye


New submission from Joannah Nanjekye :

On Linux, posix_spawn() uses vfork() instead of fork() which blocks
the parent process. The child process executes exec() early and so we
don't pay the price of duplicating the memory pages (the thing which
tracks memory pages of a process). 

On macOS, posix_spawn() is a system call, so the kernel is free to use
fast-paths to optimize it as they want.

posix_spawn() is faster but it's also safer: it allows us to do a lot of
"actions" before exec(), before executing the new program. For
example, you can close files and control signals. Again, on macOS,
these actions are "atomic" since it's a system call. On Linux, glibc uses a 
very good implementation which has no race condition.

Currently, Python uses a C extension _posixsubprocess which more or
less reimplements posix_spawn(): close file descriptors, make some
file descriptors inheritable or not, etc. It is very tricky to write
correct code: code run around fork() is very fragile. In theory, the
POSIX specification only allows to use "async-signal-safe" functions
after fork()...

So it would be great to avoid _posixsubprocess whenever possible for
(1) speed (2) correctness.

--
components: Library (Lib)
messages: 332151
nosy: nanjekyejoannah, vstinner
priority: normal
pull_requests: 10472
severity: normal
status: open
title: use os.posix_spawn in subprocess
type: enhancement
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



[issue35257] Avoid leaking linker flags into distutils: add PY_LDFLAGS_NODIST

2018-12-19 Thread STINNER Victor


STINNER Victor  added the comment:

TL; DR PR 10900 passed my manual tests ;-)

I made some tests on PR 10900, commit d1655f939d0eeeca24c2a4fee635da087e0d499b, 
using 3 shell scripts.

(1) step1.sh:
--
set -x -e
git clean -fdx
./configure CC=clang --with-lto --prefix /opt/py38
make 2>&1|tee log
grep -E -- '-o python|-o Python/bltinmodule.o|Modules/_asynciomodule.o' 
log|grep -c lto
# 4 expected: -flto passed to compiler *and* linker
--

(2) step2.sh:
--
set -e -x
rm -rf /opt/py38
mkdir /opt/py38
make install
/opt/py38/bin/python3.8-config --cflags --ldflags --libs|grep -c lto ||:
# "0" expected here: no LTO
LD_LIBRARY_PATH=/opt/py38/lib /opt/py38/bin/python3.8 -c 'import sysconfig; 
print("lto" in sysconfig.get_config_var("LDFLAGS"))'
# "False" expected: no LTO in LDFLAGS
--

(3) step3.sh:
--
set -e -x
tar -xf ../Pillow-5.3.0.tar.gz
cd Pillow-5.3.0/
LD_LIBRARY_PATH=/opt/py38/lib /opt/py38/bin/python3.8 setup.py install 2>&1|tee 
log
grep -c lto log
--

Get Pillow tarball using:

wget 
https://files.pythonhosted.org/packages/1b/e1/1118d60e9946e4e77872b69c58bc2f28448ec02c99a2ce456cd1a272c5fd/Pillow-5.3.0.tar.gz


== master ==

master branch, ./configure CC=clang --with-lto:

(1) 4
(2) 0, True => ERR
(3) 5 => ERR

master branch, ./configure CC=clang --with-lto --enable-shared:

(1) 4
(2) 0, True => ERR
(3) 5 => ERR


== PR ==

With PR 10900, ./configure CC=clang --with-lto:

(1) 4
(2) 0, False => OK!
(3) 0 => OK!

With PR 10900, ./configure CC=clang --with-lto --enable-shared:

(1) 4
(2) 0, False => OK!
(3) 0 => OK!

--

___
Python tracker 

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



[issue35420] how to migrate a c-extension module to one that supports subinerpreters?

2018-12-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

Hi (and sorry for the delay -- it's a busy time of year).

Unfortunately, there's no good documentation yet. Python's standard library 
itself is not free of global state, and I don't think we want to start 
documenting before that's fixed.

--

___
Python tracker 

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



[issue35526] __future__.barry_as_FLUFL documented as mandatory for Python 3.9

2018-12-19 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


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



[issue35526] __future__.barry_as_FLUFL documented as mandatory for Python 3.9

2018-12-19 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:


New changeset 55cc34500e5abbfedb89adc95e3f94d53c544933 by Barry Warsaw (Chris 
Rands) in branch 'master':
bpo-35526: make __future__.barry_as_FLUFL mandatory for Python 4.0 (#11218)
https://github.com/python/cpython/commit/55cc34500e5abbfedb89adc95e3f94d53c544933


--

___
Python tracker 

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



[issue35302] create_connection with local_addr misses valid socket bindings

2018-12-19 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

A better workaround is IMHO to force the socket to be IPV6 only:

sd = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
sd.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)

That avoids the ordering problem as well as having to try all possible 
combinations of source and destination addreses.

I've tested that setting this option makes it impossible to bind a IPv6 socket 
to an IPv4 address.  This is on macOS 10.14.2, I haven't checked other versions 
of macOS.

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue35535] time.strptime() unexpectedly gives the same result for %U and %W for 2018

2018-12-19 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

The results from ruby are the same as Python master as a data point. From the 
docs 

%U - Week number of the year (Sunday as the first day of the week) as a zero 
padded decimal number. All days in a new year preceding the first Sunday are 
considered to be in week 0.
%W - Week number of the year (Monday as the first day of the week) as a decimal 
number. All days in a new year preceding the first Monday are considered to be 
in week 0.
%w - Weekday as a decimal number, where 0 is Sunday and 6 is Saturday.

So with 51 (%U) strptime is returning week number 51 of the year (51st sunday, 
23/12/2018) with Sunday as the first day of the week and with %w (first weekday 
with 0 as Sunday) as 0 it returns 23/12/2018 which is the first sunday. With 51 
(%W) strptime is returning week number 51 of the year with Monday (51st Monday, 
17/12/2018) as the first day of the week (2018 starts with Monday) and hence 
with %w as 0 it returns the next sunday (23/12/2018) as first weekday (sunday). 
Where it goes little counter-intuitive is time.strptime('51 1 2018',"%W %w %Y") 
returns 17/12/2018, Monday of the 51st monday as week number that returns the 
17/12/2018 but time.strptime('51 0 2018',"%W %w %Y") returns 23/12/2018 so 
first weekday is higher than the second weekday.

CPython master

$ ./python.exe
Python 3.8.0a0 (heads/master:1dd035954b, Dec 18 2018, 10:12:34)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> dw='51 0 18'
>>> time.strptime(dw,"%U %w %y")
time.struct_time(tm_year=2018, tm_mon=12, tm_mday=23, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=6, tm_yday=357, tm_isdst=-1)
>>> time.strptime(dw,"%W %w %y")
time.struct_time(tm_year=2018, tm_mon=12, tm_mday=23, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=6, tm_yday=357, tm_isdst=-1)
>>> time.strptime(dw,"%U %w %y") == time.strptime(dw,"%W %w %y")
True

Ruby

$ irb
irb(main):001:0> require 'date'
=> true
irb(main):002:0> DateTime::strptime("51 0 18", "%W %w %y")
=> #
irb(main):003:0> DateTime::strptime("51 0 18", "%U %w %y")
=> #
irb(main):004:0> DateTime::strptime("51 0 18", "%U %w %y") == 
DateTime::strptime("51 0 18", "%W %w %y")
=> true

--
nosy: +belopolsky, p-ganssle, xtreak

___
Python tracker 

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



[issue35441] Dead (and buggy) code due to mishandling of PyList_SetItem() errors

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue35441] Dead (and buggy) code due to mishandling of PyList_SetItem() errors

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 89b5ea297d67f5efeb8fca0b63fa3d9f7030b2f0 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-35441: Remove dead and buggy code related to PyList_SetItem(). 
(GH-11033) (GH-11234)
https://github.com/python/cpython/commit/89b5ea297d67f5efeb8fca0b63fa3d9f7030b2f0


--

___
Python tracker 

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



[issue35536] Calling built-in locals() and globals() in C++ leads to SystemError

2018-12-19 Thread Никита Сиргиенко

New submission from Никита Сиргиенко :

System:
  Distributor ID: Ubuntu
  Description:Ubuntu 18.04.1 LTS
  Release:18.04
  Codename:   bionic
  Arch:   x86_64

Compilier:
  g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

Python versions:
  Python 3.6.7-1
  Python 2.7.15rc1

Description:
  This C++ code:

PyObject* pBuiltin = PyImport_ImportModule("builtins");
PyObject* py_globals_fun = PyObject_GetAttrString(pBuiltin,"locals");
PyObject* globals = PyObject_CallObject(py_globals_fun, NULL);

  produces "SystemError: frame does not exist".
  For function "globals" output is "SystemError: returned NULL without 
  setting an error". For python2 this code produces similar errors (descriptions
  of error little different).

  Another functions with arguments, like "abs", works fine.
  And calling function with optional argument, like "int", "float" 
  works with this code (with null parameter) without problem.

--
components: Library (Lib)
messages: 332144
nosy: Никита Сиргиенко
priority: normal
severity: normal
status: open
title: Calling built-in locals() and globals() in C++ leads to SystemError
type: behavior
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue34160] ElementTree not preserving attribute order

2018-12-19 Thread Julian Sivertsen


Julian Sivertsen  added the comment:

I don't understand why this library should go out of its way to support the old 
behavior when it seems like the only thing it breaks is tests that assume 
something that was never guaranteed and where you can get the old behavior in 
just two lines of Python:

for node in root.iter():
node.attrib = dict(sorted(node.items()))

Kind regards from confused Pythoner that just wonted the attribute order to 
make sense

--
nosy: +sivert

___
Python tracker 

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



[issue35524] using/windows launcher image might be deprecated

2018-12-19 Thread Jules Lasne


Jules Lasne  added the comment:

Here it is again, with display scaling disabled ! :)

--
Added file: https://bugs.python.org/file48007/Screenshot_2.png

___
Python tracker 

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



[issue35524] using/windows launcher image might be deprecated

2018-12-19 Thread Steve Dower


Steve Dower  added the comment:

It looks like display scaling, which you'll need to disable for this. The UI 
for the installer is slightly aware of scaling, but not enough to resize 
multiline elements automatically.

--

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2018-12-19 Thread Nick Coghlan


Nick Coghlan  added the comment:

Note that the above distinction is also the rationale for introducing the new 
subtype: so that it's easy to tell the difference between "that module was not 
found at all" (ModuleNotFoundError) and "the module was found, but attempting 
to actually load it failed" (other cases of ImportError)

--

___
Python tracker 

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



[issue35486] subprocess module import hooks breaks back compatibility

2018-12-19 Thread Nick Coghlan


Nick Coghlan  added the comment:

The two errors mean different things: ModuleNotFoundError means literally that 
the module could not be found at all (i.e. no import hook offered to try to 
load it)

A plain ImportError then means that the module was located, but attempting to 
actually load it failed.

find_spec()/find_loader()/find_module() implementations on import plugins 
shouldn't be raising exceptions for modules they don't offer, and hence 
shouldn't be needing to raise ModuleNotFoundError directly.

--

___
Python tracker 

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



[issue15626] unittest.main negates -bb option and programmatic warning configuration

2018-12-19 Thread Nick Coghlan


Nick Coghlan  added the comment:

Aye, the relevant change here would be the fact that -b and -bb now modify 
sys.warnoptions, rather than the warnings module being aware of those command 
line options specifically: https://docs.python.org/3/whatsnew/3.7.html#warnings

As a result, unittest.main will see a non-empty sys.warnoptions in 3.7+ when 
-bb is passed.

That means most of Ben's original request has been implemented, with the one 
remaining aspect being the request for an officially documented and supported 
way to tell unittest.main to leave the warnings filters alone (regardless of 
the value of sys.warnoptions)

--

___
Python tracker 

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



[issue35302] create_connection with local_addr misses valid socket bindings

2018-12-19 Thread twisteroid ambassador


Change by twisteroid ambassador :


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

___
Python tracker 

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



[issue29707] os.path.ismount() always returns false for mount --bind on same filesystem

2018-12-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not sure that we need to change ismount(), but its behavior should be 
documented.

--

___
Python tracker 

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



[issue35302] create_connection with local_addr misses valid socket bindings

2018-12-19 Thread twisteroid ambassador


twisteroid ambassador  added the comment:

IMO macOS is at fault here, for even allowing an IPv6 socket to bind to an IPv4 
address. ;-)

I have given some thought about this issue when writing my happy eyeballs 
library. My current solution is closest to Neil's first suggestion, i.e. each 
pair of remote addrinfo and local addrinfo is tried in a connection attempt.

--
nosy: +twisteroid ambassador

___
Python tracker 

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



[issue29707] os.path.ismount() always returns false for mount --bind on same filesystem

2018-12-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +10470
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



[issue35535] time.strptime() unexpectedly gives the same result for %U and %W for 2018

2018-12-19 Thread Paul Keating


New submission from Paul Keating :

This was originally reported on StackOverflow (53829118) and I believe the 
poster has found a genuine issue. He reported a problem converting from Python 
2.3 to Python 2.7 in which strptime() produced a different result for %U in the 
two versions. For lack of an old enough copy of Python, I can not reproduce the 
Python 2.3 result, which he reports as follows:

Python 2.3.4

>>> dw='51 0 18' # 51 week number, 0 for Sunday and 18 for year 2018
>>> date=time.strptime(dw,"%U %w %y")
>>> print date 
(2018, 12, 16, 0, 0, 0, 6, 350, -1) # 2018 12 16
[Remark: This output looks like Python 2.1 to me, but the issue is not the 
datatype of the result but the value of the result.]

Python 2.7.5

>>> dw='51 0 18' # 51 week number, 0 for Sunday and 18 for year 2018
>>> date=time.strptime(dw,"%U %w %y")
>>> print date
time.struct_time(tm_year=2018, tm_mon=12, tm_mday=23, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=6, tm_yday=357, tm_isdst=-1)

The point here is that the day of the month has shifted from 16 December to 23 
December, and I believe that 16 December is correct.

In ISO week numbers, week 51 in 2018 runs from Monday 17 to Sunday 23 December. 
So the Python 2.7.5 result is correct for ISO week numbers. Only, ISO week 
numbers are provided by directive %W. 

%U is supposed to work with the week numbering system common (as I understand 
it) in North America, where (according to Wikipedia) week 1 begins on a Sunday, 
and contains both 1 January and the first Saturday of the year. While I am not 
familiar with that system, Excel 2016 is, and it reports 

=WEEKNUM(DATE(2018,12,16))  as 51
=ISOWEEKNUM(DATE(2018,12,16))  as 50 

But if I do the following in Python (2.6, 2.7 or 3.5) I get the week numbers 
reported as the same:

>>> dw='51 0 18' # 51 week number, 0 for Sunday and 18 for year 2018
>>> time.strptime(dw,"%U %w %y") == time.strptime(dw,"%W %w %y")
True
[Should be False]

So directives %U and %W are producing the equal results for this date, and 
further checking shows that the same unexpected equality appears for all 
Sundays in 2018. And I get the same unexpected equality for the Sunday of the 
51st week of years 2063, 2057, 2052, 2046, 2035, 2027, 2007, 2001. It looks to 
recur when 1 January of a given year is a Monday. 

Now, it may be going too far to say that Excel is right and the Python standard 
library is wrong. It is clear that the algorithms are just systematically 
different. On the other hand, it appears that Python 2.3 did it the way that 
Excel does, and that raises the question of why Python does it differently now. 

A bit of searching reveals that people who complain that Excel's WEEKNUM 
function is wrong are generally just unaware that there are competing systems. 
So this difference is not in the same category as Excel's numbering of days 
before 1 March 1900.

--
components: Library (Lib)
messages: 332135
nosy: Paul Keating
priority: normal
severity: normal
status: open
title: time.strptime() unexpectedly gives the same result for %U and %W for 2018
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue35499] "make profile-opt" overrides CFLAGS_NODIST

2018-12-19 Thread STINNER Victor


Change by STINNER Victor :


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



[issue35499] "make profile-opt" overrides CFLAGS_NODIST

2018-12-19 Thread STINNER Victor


STINNER Victor  added the comment:

> (...) things like PGO often require flags that the linker sees in order to 
> generate the instrumented binary. If those are left off of the link step, you 
> won't have an instrumented binary and won't generate profile data.

Oh, I didn't try my PR...

$ ./configure --enable-optimizations
$ make
...
/usr/bin/ld: libpython3.8m.a(myreadline.o):(.data+0xa0): undefined reference to 
`__gcov_merge_add'
...

My PR simply doesn't work: we have to pass PGO flags to the linker. At least 
for the first step generating a profile.

My bad, sorry, I close my PR 11219.

--

___
Python tracker 

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



[issue35497] Libary select docs enhance

2018-12-19 Thread Xiang Zhang


Change by Xiang Zhang :


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



[issue35497] Libary select docs enhance

2018-12-19 Thread miss-islington


miss-islington  added the comment:


New changeset a11d44056e4f9b64d28efec295e1c1c45d4cb9e1 by Miss Islington (bot) 
in branch '3.7':
bpo-35497: add versionadded tag for EPOLLEXCLUSIVE (GH-11162)
https://github.com/python/cpython/commit/a11d44056e4f9b64d28efec295e1c1c45d4cb9e1


--
nosy: +miss-islington

___
Python tracker 

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



[issue35534] SIGSEGV in stackdepth_walk

2018-12-19 Thread Marcin Gozdalik


Marcin Gozdalik  added the comment:

#0  0x004f4af3 in stackdepth_walk (maxdepth=5, depth=3, b=, c=) at ../Python/compile.c:3436
#1  stackdepth_walk (maxdepth=, depth=0, b=, 
c=0x7fff4f5b84f0) at ../Python/compile.c:3456
#2  stackdepth (c=0x7fff4f5b84f0) at ../Python/compile.c:3486
#3  makecode.isra.19 (c=0x7fff4f5b84f0) at ../Python/compile.c:3854
#4  assemble.lto_priv () at ../Python/compile.c:3960
#5  0x004e31ad in compiler_mod (mod=0x10456d8, c=0x7fff4f5b84f0) at 
../Python/compile.c:1212
#6  PyAST_Compile () at ../Python/compile.c:292
#7  0x0051e6b0 in Py_CompileStringFlags (
str=0x11c9e54 "try:\nfrom urllib.parse import urljoin\nexcept 
ImportError:\nfrom urlparse import urljoin\n\n\ntry:\nimport cPickle as 
pickle\nexcept ImportError:\nimport pickle\n\n\n# Handle the case where the 
r"..., 
filename=filename@entry=0x7f42be6fb054 
"/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/compat.py",
 start=start@entry=257, 
flags=flags@entry=0x0) at ../Python/pythonrun.c:1433
#8  0x0051c924 in compile_source (
source='try:\nfrom urllib.parse import urljoin\nexcept ImportError:\n   
 from urlparse import urljoin\n\n\ntry:\nimport cPickle as pickle\nexcept 
ImportError:\nimport pickle\n\n\n# Handle the case where the requests 
module has been patched to not have\n# urllib3 bundled as part of its 
source.\ntry:\nfrom requests.packages.urllib3.response import 
HTTPResponse\nexcept ImportError:\nfrom urllib3.response import 
HTTPResponse\n\ntry:\nfrom requests.packages.urllib3.util import 
is_fp_closed\nexcept ImportError:\nfrom urllib3.util import 
is_fp_closed\n', pathname=0x7f42be6fb054 
"/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/compat.py")
at ../Modules/zipimport.c:1148
#9  get_code_from_data.isra.2 (

toc_entry=('/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/compat.py',
 8, 216, 548, 7375, 42352, 18741, 1691478637), mtime=, 
isbytecode=0) at ../Modules/zipimport.c:1222
#10 get_module_code.lto_priv () at ../Modules/zipimport.c:1263
#11 0x00532b72 in zipimporter_load_module.lto_priv () at 
../Modules/zipimport.c:320
#12 0x004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#13 0x004cdd9d in call_function_tail 
(args=('pip._vendor.cachecontrol.compat',), 
callable=) at ../Objects/abstract.c:2578
#14 PyObject_CallMethod () at ../Objects/abstract.c:2653
#15 0x004a4be1 in import_submodule.lto_priv () at 
../Python/import.c:2722
#16 0x004a42d9 in load_next (p_buflen=, 
buf=0x1042cf0 "pip._vendor.cachecontrol.compat", p_name=, 
altmod=, 
mod=) at ../Python/import.c:2537
#17 import_module_level.isra.3 (level=0, fromlist=('HTTPResponse', 'pickle'), 
globals=, name=) at ../Python/import.c:2246
#18 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#19 0x004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#20 0x004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#21 0x004c5ef0 in PyEval_CallObjectWithKeywords () at 
../Python/ceval.c:4219
#22 0x004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#23 0x004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#24 0x004b9856 in PyEval_EvalCode (co=, 
globals=, locals=) at ../Python/ceval.c:669
#25 0x004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#26 0x00532bd0 in zipimporter_load_module.lto_priv () at 
../Modules/zipimport.c:360
#27 0x004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#28 0x004cdd9d in call_function_tail 
(args=('pip._vendor.cachecontrol.serialize',), 
callable=) at ../Objects/abstract.c:2578
#29 PyObject_CallMethod () at ../Objects/abstract.c:2653
#30 0x004a4be1 in import_submodule.lto_priv () at 
../Python/import.c:2722
#31 0x004a42d9 in load_next (p_buflen=, 
buf=0x1040cd0 "pip._vendor.cachecontrol.serialize", p_name=, 
altmod=, 
mod=) at ../Python/import.c:2537
#32 import_module_level.isra.3 (level=0, fromlist=('Serializer',), 
globals=, name=) at ../Python/import.c:2246
#33 PyImport_ImportModuleLevel () at ../Python/import.c:2310
#34 0x004a5ae4 in builtin___import__ () at ../Python/bltinmodule.c:49
#35 0x004a587e in PyObject_Call () at ../Objects/abstract.c:2546
#36 0x004c5ef0 in PyEval_CallObjectWithKeywords () at 
../Python/ceval.c:4219
#37 0x004bec4b in PyEval_EvalFrameEx () at ../Python/ceval.c:2622
#38 0x004b9b66 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#39 0x004b9856 in PyEval_EvalCode (co=, 
globals=, locals=) at ../Python/ceval.c:669
#40 0x004b978f in PyImport_ExecCodeModuleEx () at ../Python/import.c:731
#41 0x00532bd0 in zipimporter_load_module.lto_priv () at 
../Modules/zipimport.c:360
#42 0x004a587e in PyObject_Call () at 

[issue35497] Libary select docs enhance

2018-12-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10469

___
Python tracker 

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



[issue35530] Counter-intuitive logging API

2018-12-19 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

> If you have 3.8 installed, feel free to test the code yourself and report 
> what happens.

I tested it on master and it's the same as per the original report.

➜  cpython git:(master) cat ../backups/bpo35530_1.py
import logging
logger = logging.getLogger(name='main')
logger.setLevel(logging.INFO)
logger.error('XXX')
logging.error('ZZZ')
logger.error('XXX')
➜  cpython git:(master) ./python.exe
Python 3.8.0a0 (heads/master:1dd035954b, Dec 18 2018, 10:12:34)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
➜  cpython git:(master) ./python.exe ../backups/bpo35530_1.py
XXX
ERROR:root:ZZZ
ERROR:main:XXX


root is parent for all logger objects created down the inheritance chain. When 
there is no root handler for logger then it resorts to lastResort handler (As 
per name called on last resort when there is no handler even for root) whose 
format is "%(message)s". Calling logging.error sets the root's handler (like 
doing logging.basicConfig). When there is a root with handler then subsequent 
logger calls the root's handler but lastResort is not called since it has found 
the root handler. I agree with Mark that this could affect downstream and is 
very hard to debug when libraries have wrong configuration.

import logging
logger = logging.getLogger(name='main')
logger.setLevel(logging.INFO)
logger.error('XXX')
print("logger parent ", logger.parent) # Root is always the parent by default
print("logger parent handlers ", logger.parent.handlers) # No root handler 
since root is not configured which logging error does below
print("logger handler ", logger.handlers) # Empty and no parent (root) handler 
so calls lastResort
logging.error('ZZZ') # Sets the root handler
print("logger parent after logging ", logger.parent) # Root is parent
print("logger parent handlers after logging ", logger.parent.handlers) # Root 
handler is set
print("logger handler after logging ", logger.handlers) # Empty but has parent 
(root) handler so lastResort is not called
logger.error('XXX')

Output : 

XXX
logger parent  
logger parent handlers  []
logger handler  []
ERROR:root:ZZZ
logger parent after logging  
logger parent handlers after logging  [ (NOTSET)>]
logger handler after logging  []
ERROR:main:XXX

--

___
Python tracker 

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



[issue35497] Libary select docs enhance

2018-12-19 Thread Xiang Zhang


Xiang Zhang  added the comment:


New changeset 92330c0b6d6c253c41a133cc50caea4853c7e311 by Xiang Zhang 
(Manjusaka) in branch 'master':
bpo-35497: add versionadded tag for EPOLLEXCLUSIVE (GH-11162)
https://github.com/python/cpython/commit/92330c0b6d6c253c41a133cc50caea4853c7e311


--

___
Python tracker 

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



[issue35534] SIGSEGV in stackdepth_walk

2018-12-19 Thread Marcin Gozdalik


New submission from Marcin Gozdalik :

When running

/usr/bin/python /usr/bin/pip install --upgrade "pip < 10"

the interpreter crashed in stackdepth_walk. I've seen this crash multiple 
times, especially in our custom-compiled CPythons. Here it's 
reproduced with stock Ubuntu Xenial Python. It looks like it happens much more 
often on AMD Ryzens although it happens also on Intel CPUs.
The Ryzen is otherwise stable.

Sys details:

Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2

Package python-minimal 2.7.12-1~16.04 from Ubuntu Xenial

--
components: Interpreter Core
files: core.pip.8270.1545144472.xz
messages: 332129
nosy: gozdal
priority: normal
severity: normal
status: open
title: SIGSEGV in stackdepth_walk
type: crash
versions: Python 2.7, Python 3.6
Added file: https://bugs.python.org/file48006/core.pip.8270.1545144472.xz

___
Python tracker 

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



[issue35533] argparse standard error usage for exit / error

2018-12-19 Thread Philip Rowlands


New submission from Philip Rowlands :

Because error() mentions standard error and exit() does not, I assumed exit() 
did not use stderr, but it does.

Please mention standard error in the description of exit().

Relevant code at:
https://github.com/python/cpython/blob/3.7/Lib/argparse.py#L2482

--
assignee: docs@python
components: Documentation
messages: 332128
nosy: docs@python, philiprowlands
priority: normal
severity: normal
status: open
title: argparse standard error usage for exit / error
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue35530] Counter-intuitive logging API

2018-12-19 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

> What would the exception say?
>
>FatalError: no error occurred

haha, I mean a message that tell you something to avoid have some weird behave 
(like here). :-)

> If you have 3.8 installed, feel free to test the code yourself and report 
> what happens.

Ok!

--

___
Python tracker 

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



[issue35530] Counter-intuitive logging API

2018-12-19 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I completely missed it.

You're not alone. Authors of many of the libraries that we work with on a 
day-to-day basis missed it, too. And that results in logging being accidentally 
configured as a side-effect halfway through a long test run, when one of those 
libraries happens to be imported. That it turn leads to heisenbug-like test 
failures (e.g., tests that fail locally but pass on Travis CI or Appveyor, or 
vice versa, just because one test accidentally configures logging, another test 
checks for particular logged messages, and unittest happened to run the tests 
in different orders in different setups).

This is a real problem for Enthought, where we write large, well-tested (our 
test suites commonly include thousands of tests) applications. In those 
circumstances, test interactions (tests that fail after some other test has 
been run, but don't fail when run standalone) are one of the biggest sources of 
pain.

Vinay claims in the #34350 discussion that:

> that's just like any other bug introduced because of a typo. It would 
> presumably get caught in testing.

This isn't true in practice. The "bug" here is accidental configuration of 
logging by a library (possibly by one's own code, possibly by a third-party 
library that's being sued directly or indirectly). And unless you know about 
this possibility in advance, you're not going to test for it. If it does get 
caught in testing, it's in the form of the unpleasant test interactions 
described above. I've witnessed various third-party libraries configuring 
logging accidentally and not realising it; it doesn't tend to cause problems 
for the library directly - it causes problems for the downstream users of those 
libraries.

If this behaviour can't be changed for backwards compatibility reasons, then so 
be it. But I think it would be disingenuous to claim it's not a design flaw.




--

___
Python tracker 

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



[issue35530] Counter-intuitive logging API

2018-12-19 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

On Wed, Dec 19, 2018 at 10:37:22AM +, Mark Dickinson wrote:
> 
> Mark Dickinson  added the comment:
> 
> The call to `logging.error` is *not* irrelevant here. It's causing an 
> implicit, and surprising (albeit documented), call to 
> `logging.basicConfig`.

Ah, thanks.

And of course the documentation you refer to is right there in the 
paragraph above the one I linked to earlier, and I completely missed it. 
Ouch.

--

___
Python tracker 

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



[issue35524] using/windows launcher image might be deprecated

2018-12-19 Thread Jules Lasne


Jules Lasne  added the comment:

Here is the image, it should be the same size (by a few pixels).

Oddly enough, I couldn't get the bottom part to unfold and I can't figure out 
why

--
Added file: https://bugs.python.org/file48005/win_install_python.png

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-12-19 Thread Nick Coghlan


Nick Coghlan  added the comment:

I still think the current Python 3.7 behaviour makes the CPython runtime a 
badly behaved C library, since we may end up changing the active libc locale 
even when it isn't the main application, and a change hasn't been explicitly 
requested by the embedding app.

However, the only way to encounter that misbehaviour is to be running a 
Unicode-unfriendly embedding application that leaves the C locale in place on a 
Unicode-unfriendly operating system that doesn't set a more sensible locale in 
the first place.

I've also gone through a few iterations on 
https://github.com/python/cpython/pull/9257 now, and respecting the -E and -I 
options *without* deferring locale coercion until the same point where UTF-8 
mode is checked for turns out to require duplication of an irritatingly large 
amount of argument processing code (as even if all you're checking for is two 
options that don't take arguments, you still need to correctly skip over all 
the other permitted arguments, stop at the arguments that terminate the python 
option list, and find the options of interest even when they're in a combined 
option string like "-vI").

Accordingly, I no longer think it's worth pursuing this change purely to 
assuage my sense of responsibility to developers of applications embedding the 
Python runtime - instead, we can leave the Python 3.7.0 solution in place for 
3.8 as well, until such time as we have embedding application authors actually 
reporting bug reports against the Python 3.7 behaviour.

To be completely honest, I expect the odds of that actually happening in 
practice to be incredibly low, and even if it does happen, our answer may well 
be to point to the in-development multi-phase configuration API rather than 
allowing it to be disabled when using Py_Initialize() and/or Py_Main().

--
resolution:  -> postponed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue35530] Counter-intuitive logging API

2018-12-19 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> That's true. Maybe and warning or Exception can be raise?

Why would we raise a warning or exception for expected behaviour? 
logging.error() and some_instance.error() don't necessarily produce the 
same output. What would the exception say?

FatalError: no error occurred

*wink*

> and 3.8?

If you have 3.8 installed, feel free to test the code yourself and 
report what happens.

--

___
Python tracker 

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



[issue35530] Counter-intuitive logging API

2018-12-19 Thread Mark Dickinson


Mark Dickinson  added the comment:

The call to `logging.error` is *not* irrelevant here. It's causing an implicit, 
and surprising (albeit documented), call to `logging.basicConfig`.

https://bugs.python.org/issue34350 is essentially the same issue. That issue 
was closed as "not a bug", though I think a more appropriate resolution would 
have been "won't fix". In my mind, this is a design flaw in logging, and it's 
one that's caused my colleagues and me real-world pain on multiple occasions.

There may be backwards compatibility constraints that make it impossible to fix 
this. I haven't looked into what would be needed.

--
nosy: +mark.dickinson

___
Python tracker 

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



  1   2   >