[issue34601] Typo: "which would rather raise MemoryError than give up", than or then?

2018-09-07 Thread David Lin


New submission from David Lin :

https://docs.python.org/3/library/exceptions.html

exception OverflowError
Raised when the result of an arithmetic operation is too large to be 
represented. This cannot occur for integers (which would rather raise 
MemoryError than give up). However, for historical reasons, OverflowError is 
sometimes raised for integers that are outside a required range. Because of the 
lack of standardization of floating point exception handling in C, most 
floating point operations are not checked.

In sentence: "which would rather raise MemoryError than give up", should we use 
"then" instead of "than"?

Thanks,
David Lin

--
assignee: docs@python
components: Documentation
messages: 324720
nosy: davidlin, docs@python
priority: normal
severity: normal
status: open
title: Typo: "which would rather raise MemoryError than give up", than or then?
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



[issue34599] improve performance of _Py_bytes_capitalize()

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

Nice optimization Sergey Fedoseev, thanks!

--
nosy: +vstinner

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8f735485acf2e35a75d2fa019feb8f905598c4e5 by Victor Stinner 
(jdemeyer) in branch 'master':
bpo-25750: fix refcounts in type_getattro() (GH-6118)
https://github.com/python/cpython/commit/8f735485acf2e35a75d2fa019feb8f905598c4e5


--

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8547

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8546

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8548

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8554

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue34604] Possible mojibake in pwd.getpwnam and grp.getgrnam

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 28658485a54ad5f9df52ecc12d9046269f1654ec by Victor Stinner 
(William Grzybowski) in branch 'master':
bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() (GH-9098)
https://github.com/python/cpython/commit/28658485a54ad5f9df52ecc12d9046269f1654ec


--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

> The Django PR is an unreadable infinitely-long page of miserable arguing.  So 
> the context doesn't help much.

In short, some people associate the words "master" and "slave" to slavery. To 
enhance the diversity in the Python community, I suggest to try to avoid these 
terms whenever possible. As I wrote in previous comments, it seems like we have 
to keep them in a few places.

--

___
Python tracker 

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



[issue34604] Possible mojibake in pwd.getpwnam and grp.getgrnam

2018-09-07 Thread William Grzybowski


Change by William Grzybowski :


--
pull_requests: +8559

___
Python tracker 

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



[issue34609] Idle Unitest

2018-09-07 Thread pisc...@yahoo.fr


New submission from pisc...@yahoo.fr :

Idle is unable to import unittest. and raises an attributeError.
Output of the Python shell Idle is included in the file bug idle.

several files raise this exception
on of them is included in this report
the Trace for Idle is as follows :
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 
[GCC 7.3.0] on linux
Type "copyright", "credits" or "license()" for more information.
>>> 
[DEBUG ON]
>>> 
 RESTART: 
/home/odile/Documents/dev_logiciels/pyhton/openclassrooms/labyrinthe/roboc2/test/test_carte.py
 
Traceback (most recent call last):
  File 
"/home/odile/Documents/dev_logiciels/pyhton/openclassrooms/labyrinthe/roboc2/test/test_carte.py",
 line 5, in 
import unittest
  File "", line 968, in _find_and_load
  File "", line 148, in __enter__
  File "", line 174, in _get_module_lock
  File "", line 59, in __init__
  File "", line 59, in __init__
  File "/usr/lib/python3.6/bdb.py", line 51, in trace_dispatch
return self.dispatch_line(frame)
  File "/usr/lib/python3.6/bdb.py", line 69, in dispatch_line
self.user_line(frame)
  File "/usr/lib/python3.6/idlelib/debugger.py", line 24, in user_line
self.gui.interaction(message, frame)
AttributeError: '_ModuleLock' object has no attribute 'name'
[DEBUG ON]

Idle version is 3.6.5

--
assignee: terry.reedy
components: IDLE
files: test_main.py
messages: 324779
nosy: pisc...@yahoo.fr, terry.reedy
priority: normal
severity: normal
status: open
title: Idle Unitest
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47790/test_main.py

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for merging PRs Victor, but seems you have merged wrong PR for 2.7.

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Larry Hastings


Larry Hastings  added the comment:

I'm a little surprised by this.  It's not like slavery was acceptable when 
these computer science terms were coined and it's only comparatively recently 
that they've gone out of fashion.  On the other hand, there are some areas in 
computer software where "master" and "slave" are the exact technical terms 
(e.g. IDE), and avoiding them would lead to confusion.

Of the four citations you reference, one of them is a PR for Django, and three 
of them say "see the Django PR".  The Django PR is an unreadable 
infinitely-long page of miserable arguing.  So the context doesn't help much.

Have there been any actual complaints?  Or is this an attempt to solve a 
problem that doesn't really exist?

--
nosy: +larry

___
Python tracker 

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



[issue34595] PyUnicode_FromFormat(): add %T format for an object type name

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8557

___
Python tracker 

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



[issue23057] [Windows] asyncio: support signal handlers on Windows (feature request)

2018-09-07 Thread Chris Warrick


Change by Chris Warrick :


--
nosy: +Kwpolska

___
Python tracker 

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



[issue34563] invalid assert on big output of multiprocessing.Process

2018-09-07 Thread Oleksandr Buchkovskyi


Oleksandr Buchkovskyi  added the comment:

thank you for all the help in merging this fix!

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8556

___
Python tracker 

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



[issue34595] PyUnicode_FromFormat(): add %T format for an object type name

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 886483e2b9bbabf60ab769683269b873381dd5ee by Victor Stinner in 
branch 'master':
bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)
https://github.com/python/cpython/commit/886483e2b9bbabf60ab769683269b873381dd5ee


--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Larry Hastings


Larry Hastings  added the comment:

> > Have there been any actual complaints?
> Yes, but sadly they are private.

I'm not super-excited by the idea that Python has to change its behavior based 
on secret comments.  Python has traditionally had a very open governance model 
where all discussions happen in public.

While I understand the need to preserve the privacy of victims, is there some 
way we can bring the decision-making process out into the open?  As far as I 
can tell, the entire process so far has been "Victor concludes that these terms 
are bad, and creates and merges several PRs an hour or two later with zero 
discussion".

Perhaps the complaints could be edited to anonymize them, and then we could see 
them?  Or must Python change its governance model because of diversity concerns?

--

___
Python tracker 

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



[issue34573] Simplify __reduce__() of set and dict iterators.

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Perhaps the bug was specific to OrderedDict itrerators. I'll try to write 
additional tests, and after that I'll merge PR 9050.

--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue20104] expose posix_spawn(p)

2018-09-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 254a4663d8c5970ae2928185c50ebaa6c7e62c80 by Pablo Galindo in 
branch 'master':
bpo-20104: Add flag capabilities to posix_spawn (GH-6693)
https://github.com/python/cpython/commit/254a4663d8c5970ae2928185c50ebaa6c7e62c80


--

___
Python tracker 

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



[issue34608] gc.get_referrers behavior change 3.6 to 3.7

2018-09-07 Thread Bryan

New submission from Bryan :

When called on a local object inside a function, gc.get_referrers no longer 
returns a Frame as one of the references. I could not find anything in the 
release notes or changeling that indicated that this is an intentional change. 

The following script generates different output when run on Python 3.6 vs 
Python 3.7 (on linux, OSX, or Windows):

```
# referrers.py
import gc, sys

class FakeMod(object): pass

extra = []

def test():
mod = FakeMod()
extra.append(mod)
referrers = gc.get_referrers(mod)
print(".".join(str(x) for x in sys.version_info[:3]), ":", len(referrers), 
referrers)

test()
```

Output:

~ master*
(py37) ❯ python test.py
3.7.0 : 1 [[<__main__.FakeMod object at 0x10b65e320>]]

~ master*
(base) ❯ python test.py
3.6.6 : 2 [[<__main__.FakeMod object at 0x106f3ea90>], ]

--
components: Library (Lib)
messages: 324771
nosy: bryevdv
priority: normal
severity: normal
status: open
title: gc.get_referrers behavior change 3.6 to 3.7
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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Larry Hastings


Larry Hastings  added the comment:

As a counter-example: A quick grep finds 555 occurrences of the word "kill" in 
CPython master.  Everybody knows killing is bad and using the term might upset 
certain people.  Yet I would not support expunging the word "kill" from Python.

--

___
Python tracker 

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



[issue34604] Possible mojibake in pwd.getpwnam and grp.getgrnam

2018-09-07 Thread William Grzybowski


Change by William Grzybowski :


--
pull_requests: +8558

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

To me, there is nothing wrong with the word 'master', as such.  I mastered 
Python to become a master of Python.  Purging Python of 'master' seems 
ill-conceived.  The word 'slave' is different matter to me.

In tk and tkinter, the 'parent' and 'master' of a widget may be different 
widgets, but I cannot remember the functional difference, nor whether the terms 
are used consistently.

Like Larry, I object to action based on hidden evidence.

--
nosy: +terry.reedy -mrabarnett

___
Python tracker 

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



[issue34594] Some tests use hardcoded errno values

2018-09-07 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 18d7dff1bb6f5ca7060b0b2e2a2e74493619178f by Benjamin Peterson 
(Zackery Spytz) in branch '3.7':
[3.7] bpo-34594: Don't hardcode errno values in the tests. (GH-9094)
https://github.com/python/cpython/commit/18d7dff1bb6f5ca7060b0b2e2a2e74493619178f


--

___
Python tracker 

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



[issue34594] Some tests use hardcoded errno values

2018-09-07 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 9eeecfd5d03cfd6d5cef71de31eed7f65f0e658b by Benjamin Peterson 
(Zackery Spytz) in branch '3.6':
[3.6] bpo-34594: Don't hardcode errno values in the tests. (GH-9096)
https://github.com/python/cpython/commit/9eeecfd5d03cfd6d5cef71de31eed7f65f0e658b


--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Matthew Barnett


Matthew Barnett  added the comment:

Not all uses of the word "master" are associated with slavery, e.g. "master 
craftsman", "master copy", "master file table".

I think it's best to avoid use of master/slave where practicable, but other 
uses of "master" are not necessarily a problem.

--
nosy: +mrabarnett

___
Python tracker 

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



[issue34546] Add encryption support to zipfile

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is the reason of using such weak encryption? It looks to me that creating 
a non-encrypted ZIP file and encrypting it with third-party tools is the right 
way if you need an encryption.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue34606] Unable to read zip file with extra

2018-09-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34606] Unable to read zip file with extra

2018-09-07 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

It's also reproducible on master. git blame tells me this is introduced with 
feccdb2a249a71be330765be77dee57121866779 (https://bugs.python.org/issue29774)

➜  cpython git:(master)
commit feccdb2a249a71be330765be77dee57121866779
Author: Serhiy Storchaka 
Date:   Thu Mar 9 18:34:03 2017 +0200

bpo-29774: Improve error reporting for corrupted extra field in ZIP file. 
(#583)

diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index b5c16dbc12..8a19ca246b 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -438,7 +438,9 @@ class ZipInfo (object):
 unpack = struct.unpack
 while len(extra) >= 4:
 tp, ln = unpack(' len(extra):
+raise BadZipFile("Corrupt extra field %04x (size=%d)" % (tp, 
ln))
+if tp == 0x0001:
 if ln >= 24:
 counts = unpack('>>
➜  cpython git:(master) ./python.exe ../backups/bpo34606.py 36.zip
3.8.0a0 (heads/master:874809ea38, Sep  7 2018, 21:03:18)
[Clang 7.0.2 (clang-700.1.81)]
36.zip
Traceback (most recent call last):
  File "../backups/bpo34606.py", line 14, in 
zipfile.ZipFile(fn)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/zipfile.py", 
line 1204, in __init__
self._RealGetContents()
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/zipfile.py", 
line 1327, in _RealGetContents
x._decodeExtra()
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/zipfile.py", 
line 440, in _decodeExtra
raise BadZipFile("Corrupt extra field %04x (size=%d)" % (tp, ln))
zipfile.BadZipFile: Corrupt extra field 6568 (size=27756)
➜  cpython git:(master) ✗ rm 36.zip

# checkout feccdb2a249a71be330765be77dee57121866779

➜  cpython git:(master) git checkout feccdb2a249a71be330765be77dee57121866779 
Lib/zipfile.py
➜  cpython git:(master) ✗ ./python.exe ../backups/bpo34606.py 36.zip
3.8.0a0 (heads/master:874809ea38, Sep  7 2018, 21:03:18)
[Clang 7.0.2 (clang-700.1.81)]
36.zip
Traceback (most recent call last):
  File "../backups/bpo34606.py", line 14, in 
zipfile.ZipFile(fn)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/zipfile.py", 
line 1105, in __init__
self._RealGetContents()
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/zipfile.py", 
line 1230, in _RealGetContents
x._decodeExtra()
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/zipfile.py", 
line 442, in _decodeExtra
raise BadZipFile("Corrupt extra field %04x (size=%d)" % (tp, ln))
zipfile.BadZipFile: Corrupt extra field 6568 (size=27756)
➜  cpython git:(master) ✗ rm 36.zip

# checkout feccdb2a249a71be330765be77dee57121866779~1

➜  cpython git:(master) ✗ git checkout 
feccdb2a249a71be330765be77dee57121866779~1 Lib/zipfile.py
➜  cpython git:(master) ✗ ./python.exe ../backups/bpo34606.py 36.zip
3.8.0a0 (heads/master:874809ea38, Sep  7 2018, 21:03:18)
[Clang 7.0.2 (clang-700.1.81)]
36.zip
➜  cpython git:(master) ✗ gsha256sum 36.zip
0f54bd6ab84facfeefc2c38f12c30eb84101b3be3d91f8826f6fa36e73b86cb6  36.zip


Hope this helps. 

I am adding Serhiy who might have a better explanation. @Serhiy Feel free to 
unassign yourself if this is irrelevant.

Thanks

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7e610bcdf128f61b925654e4fa80fbac83537d0e by Victor Stinner in 
branch 'master':
bpo-34605: childs => children (GH-9102)
https://github.com/python/cpython/commit/7e610bcdf128f61b925654e4fa80fbac83537d0e


--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

> Have there been any actual complaints?

Yes, but sadly they are private.

--

___
Python tracker 

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



[issue33083] math.factorial accepts non-integral Decimal instances

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since this is potentially breaking change, please add a What's New entry for it.

--

___
Python tracker 

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



[issue34604] Possible mojibake in pwd.getpwnam and grp.getgrnam

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner
versions: +Python 2.7 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue34601] Typo: "which would rather raise MemoryError than give up", than or then?

2018-09-07 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

"than" is correct; "giving up" in this context would mean "not even trying to 
allocate the memory and just preemptively raising OverflowError, like 
non-integer numeric types with limited ranges". Rather than giving up that way, 
it chooses to try to allocate the huge integer and raises a MemoryError only if 
that fails.

--
nosy: +josh.r

___
Python tracker 

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



[issue34590] "Logging HOWTO" should share an example of best practices for using logging in a library

2018-09-07 Thread Vinay Sajip

Vinay Sajip  added the comment:

> Should I make use of a single logger object in my library, multiple loggers
> in a tree, or multiple unrelated loggers? Since I have just one public module,
> I'm tempted to say that I should just use one logger object.

Yes. The advanced logging tutorial (part of the HOWTO) states:

"A good convention to use when naming loggers is to use a module-level logger, 
in each module which uses logging, named as follows:

logger = logging.getLogger(__name__)

This means that logger names track the package/module hierarchy, and it’s 
intuitively obvious where events are logged just from the logger name."

This seems clear enough to me. Did you look at the whole of the HOWTO? If not, 
I'd advise you to take the time

> (The documentation says "No handlers could be found for logger" 
> spam only happens pre-3.2, but some of my users at least think
> they see it in later Pythons.)

In 3.2, the change was made to introduce a "handler of last resort" instead of 
the "no handlers could be found" message, which is only printed if 
logging.lastResort is set to None or other "false" value (by default, it's set 
to a console handler at WARNING level emitting to sys.stderr). If you can give 
specifics of a later Python version where this happens (precise Python version, 
OS etc.) then we can address it.

Practices vary widely because use cases for logging are widely varied. A simple 
one-off script has different needs from a product with a long shelf-life, a 
command-line application has different needs from a long-running server 
application, a single-author application has different needs from one which is 
put together from lots of different dependencies by different authors, etc.

> Why should a Logger object need to have .basicConfig() called on
> it after retrieval (where "retrieval" means "getLogger call") and
> before use anyway?

It doesn't. If you want output, you need handlers. The basicConfig() API is 
just one way of attaching handlers to loggers for simple use cases. The 
question of handlers is also no concern of a library author, other than the 
NullHandler part, as the application is where logging should be configured (as 
mentioned in the "Configuring Logging for a Library" section).

> Then we could establish the "gold standard" for logging and write
> about it in the HOWTO.

There's no one size fits all, I'm afraid, because the package is designed to 
cover a wide range of use cases, not just the simplest ones. While there is 
(IMO) comprehensive documentation, specific proposals for improvements will be 
looked at constructively.

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Just want to add that it's a constant source of problem with respect to Redis 
and antirez wrote a detailed blog post about it yesterday : 
http://antirez.com/news/122 . It causes a lot of energy and emotional drain 
when issues like this get to twitter and top pages of HN : 
https://twitter.com/antirez/status/1037809132303208455

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue34604] Possible mojibake in pwd.getpwnam and grp.getgrnam

2018-09-07 Thread William Grzybowski


Change by William Grzybowski :


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

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

IMHO it's ok to keep the "master" term for:

* Git "master" branch
* "webmaster"
* "postmaster"

To find all impacted files, I used the commend:

git grep -i -E 'master|slave'|grep -v -E 'webmaster|postmaster|/blob/master/'

--

___
Python tracker 

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



[issue34607] test_multiprocessing_forkserver is altering the environment on AMD64 FreeBSD 10.x Shared 3.7

2018-09-07 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

test_multiprocessing_forkserver is altering the environment on AMD64 FreeBSD 
10.x Shared 3.7:

https://buildbot.python.org/all/#/builders/124/builds/545/steps/4/logs/stdio

== Tests result: ENV CHANGED ==
393 tests OK.
10 slowest tests:
- test_tools: 8 min 56 sec
- test_tokenize: 5 min 47 sec
- test_multiprocessing_spawn: 5 min 42 sec
- test_multiprocessing_forkserver: 4 min 29 sec
- test_lib2to3: 4 min 3 sec
- test_multiprocessing_fork: 3 min 46 sec
- test_concurrent_futures: 3 min 43 sec
- test_asyncio: 2 min 36 sec
- test_compile: 1 min 49 sec
- test_io: 1 min 45 sec
1 test altered the execution environment:
test_multiprocessing_forkserver
22 tests skipped:
test_dbm_gnu test_devpoll test_epoll test_gdb test_idle test_ioctl
test_msilib test_ossaudiodev test_smtpnet test_spwd test_ssl
test_startfile test_tcl test_tix test_tk test_ttk_guionly
test_ttk_textonly test_turtle test_winconsoleio test_winreg
test_winsound test_zipfile64
Total duration: 20 min 58 sec
Tests result: ENV CHANGED
*** Error code 3
Stop.
make: stopped in /usr/home/buildbot/python/3.7.koobs-freebsd10/build
program finished with exit code 1
elapsedTime=1260.965772

--
components: Tests
messages: 324753
nosy: pablogsal
priority: normal
severity: normal
status: open
title: test_multiprocessing_forkserver is altering the environment on AMD64 
FreeBSD 10.x Shared 3.7
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



[issue22543] -W option cannot use non-standard categories

2018-09-07 Thread Thrlwiti


Change by Thrlwiti :


--
nosy: +THRlWiTi

___
Python tracker 

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



[issue34604] Possible mojibake in pwd.getpwnam and grp.getgrnam

2018-09-07 Thread William Grzybowski


New submission from William Grzybowski :

Issue was spotted by @vstinner while reviewing 
https://github.com/python/cpython/pull/7081

pwd.getpwnam and grp.getgrnam are susceptible to mojibake as they are using 
encoded bytes instead of unicode in the error message.

--
components: Extension Modules
messages: 324738
nosy: wg
priority: normal
severity: normal
status: open
title: Possible mojibake in pwd.getpwnam and grp.getgrnam
versions: Python 3.4, 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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-34605, libregrtest: Rename --slaveargs to --worker-args (GH-9099)

I don't think that this change should be backported to 3.7 and older, since it 
*might* break the backward compatibility.

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

I'm working on patches to change that.

--

___
Python tracker 

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



[issue34513] test_multiprocessing_spawn fails on x86 Windows7 3.7 buildbot

2018-09-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

New failure on x86 Windows7 3.x: 
https://buildbot.python.org/all/#/builders/58/builds/1295/steps/3/logs/stdio

test_no_import_lock_contention 
(test.test_multiprocessing_spawn.WithProcessesTestQueue) ... ok
Timeout (0:15:00)!
Thread 0x0f10 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\threading.py", line 
296 in wait
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\queues.py",
 line 224 in _feed
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\threading.py", line 
865 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\threading.py", line 
917 in _bootstrap_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\threading.py", line 
885 in _bootstrap
Thread 0x0ea0 (most recent call first):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\queues.py",
 line 82 in put
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\_test_multiprocessing.py",
 line 163 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 173 in handle
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 738 in assertRaises
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\_test_multiprocessing.py",
 line 862 in test_put
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 610 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\case.py", 
line 658 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 122 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\suite.py", 
line 84 in __call__
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\unittest\runner.py",
 line 176 in run
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\__init__.py",
 line 1900 in _run_suite
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\__init__.py",
 line 1990 in run_unittest
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 175 in test_runner
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 179 in runtest_inner
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\runtest.py",
 line 140 in runtest
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 286 in rerun_failed_tests
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 570 in _main
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 531 in main
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\libregrtest\main.py",
 line 584 in main
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\__main__.py", 
line 2 in 
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\runpy.py", 
line 85 in _run_code
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\runpy.py", 
line 193 in _run_module_as_main
Traceback (most recent call last):
  File "", line 1, in 
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\spawn.py",
 line 117, in spawn_main
exitcode = _main(fd)
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\spawn.py",
 line 127, in _main
self = reduction.pickle.load(from_parent)
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\connection.py",
 line 951, in rebuild_pipe_connection
handle = dh.detach()
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\reduction.py",
 line 133, in detach
self._access, False, _winapi.DUPLICATE_CLOSE_SOURCE)
PermissionError: [WinError 5] Access is denied
program finished with exit code 1

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

In the C API, PyMemoryViewObject has a mbuf.master attribute, 
Include/memoryview.h:

---
typedef struct {
PyObject_HEAD
int flags;  /* state flags */
Py_ssize_t exports; /* number of direct memoryview exports */
Py_buffer master; /* snapshot buffer obtained from the original exporter */
} _PyManagedBufferObject;


/* memoryview state flags */
#define _Py_MEMORYVIEW_RELEASED0x001  /* access to master buffer blocked */
#define _Py_MEMORYVIEW_C   0x002  /* C-contiguous layout */
#define _Py_MEMORYVIEW_FORTRAN 0x004  /* Fortran contiguous layout */
#define _Py_MEMORYVIEW_SCALAR  0x008  /* scalar: ndim = 0 */
#define _Py_MEMORYVIEW_PIL 0x010  /* PIL-style layout */

typedef struct {
PyObject_VAR_HEAD
_PyManagedBufferObject *mbuf; /* managed buffer */
Py_hash_t hash;   /* hash value for read-only views */
int flags;/* state flags */
Py_ssize_t exports;   /* number of buffer re-exports */
Py_buffer view;   /* private copy of the exporter's view */
PyObject *weakreflist;
Py_ssize_t ob_array[1];   /* shape, strides, suboffsets */
} PyMemoryViewObject;
---

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

nis module contains the error message: NisError("No NIS master found for any 
map"), but libnis has a yp_master() function, it's no like Python picked this 
name. I suggest to keep "master" here to keep Python consistent with libnis. 
And "NIP master" gives the context of the "master" term.

--

___
Python tracker 

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



[issue34602] python3 resource.setrlimit strange behaviour under macOS

2018-09-07 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I get the same error, also with python3.7. Both for homebrew and a python.org 
installer.

--
components: +macOS
nosy: +ned.deily, ronaldoussoren
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



[issue34606] Unable to read zip file with extra

2018-09-07 Thread Kyle Altendorf


New submission from Kyle Altendorf :

This was first found over in Twisted tests.  We probably aren't too terribly 
worried about it but I wanted to report here anyways.

https://twistedmatrix.com/trac/ticket/9525

Both 3.6 and 3.7 write the same file (sha at the end) based on the script in 
the first snippet.  3.6 can read both files, 3.7 can't read either.



altendky@lt:~/twisted$ cat ../z.py
import sys
import zipfile

print(sys.version)

fn = sys.argv[1]
print(fn)

with zipfile.ZipFile(fn, 'w') as zf:
zi = zipfile.ZipInfo("0")
zi.extra = b"hello, extra"
zf.writestr(zi, b"the real data")

zipfile.ZipFile(fn)


altendky@lt:~/twisted$ venv36/bin/python ../z.py 36.zip
3.6.6 (default, Jul 24 2018, 16:23:12)
[GCC 6.3.0 20170516]
36.zip


altendky@lt:~/twisted$ venv37/bin/python ../z.py 37.zip
3.7.0 (default, Jul  7 2018, 15:49:24)
[GCC 6.3.0 20170516]
37.zip
Traceback (most recent call last):
  File "../z.py", line 14, in 
zipfile.ZipFile(fn)
  File "/home/altendky/.pyenv/versions/3.7.0/lib/python3.7/zipfile.py", 
line 1200, in __init__
self._RealGetContents()
  File "/home/altendky/.pyenv/versions/3.7.0/lib/python3.7/zipfile.py", 
line 1323, in _RealGetContents
x._decodeExtra()
  File "/home/altendky/.pyenv/versions/3.7.0/lib/python3.7/zipfile.py", 
line 440, in _decodeExtra
raise BadZipFile("Corrupt extra field %04x (size=%d)" % (tp, ln))
zipfile.BadZipFile: Corrupt extra field 6568 (size=27756)


altendky@lt:~/twisted$ cat ../z.py
import sys
import zipfile

print(sys.version)

fn = sys.argv[1]
print(fn)

#with zipfile.ZipFile(fn, 'w') as zf:
#zi = zipfile.ZipInfo("0")
#zi.extra = b"hello, extra"
#zf.writestr(zi, b"the real data")

zipfile.ZipFile(fn)


altendky@lt:~/twisted$ venv36/bin/python ../z.py 37.zip
3.6.6 (default, Jul 24 2018, 16:23:12)
[GCC 6.3.0 20170516]
37.zip


altendky@lt:~/twisted$ venv37/bin/python ../z.py 36.zip
3.7.0 (default, Jul  7 2018, 15:49:24)
[GCC 6.3.0 20170516]
36.zip
Traceback (most recent call last):
  File "../z.py", line 14, in 
zipfile.ZipFile(fn)
  File "/home/altendky/.pyenv/versions/3.7.0/lib/python3.7/zipfile.py", 
line 1200, in __init__
self._RealGetContents()
  File "/home/altendky/.pyenv/versions/3.7.0/lib/python3.7/zipfile.py", 
line 1323, in _RealGetContents
x._decodeExtra()
  File "/home/altendky/.pyenv/versions/3.7.0/lib/python3.7/zipfile.py", 
line 440, in _decodeExtra
raise BadZipFile("Corrupt extra field %04x (size=%d)" % (tp, ln))
zipfile.BadZipFile: Corrupt extra field 6568 (size=27756)


altendky@lt:~/twisted$ sha256sum 36.zip
0f54bd6ab84facfeefc2c38f12c30eb84101b3be3d91f8826f6fa36e73b86cb6  36.zip


altendky@lt:~/twisted$ sha256sum 37.zip
0f54bd6ab84facfeefc2c38f12c30eb84101b3be3d91f8826f6fa36e73b86cb6  37.zip

--
components: Library (Lib)
messages: 324743
nosy: altendky
priority: normal
severity: normal
status: open
title: Unable to read zip file with extra
type: crash
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



[issue34597] Python needs to check existence of functions at runtime for targeting older macOS platforms

2018-09-07 Thread Zorg


Zorg  added the comment:

The minimum OS target (which looks like 10.13) should ideally be well defined 
and tested using the latest SDK, rather than there being "no promises". Or at 
least it should be documented that this isn't currently supported, or how to 
disable specific features and which ones to disable. I downloaded the source 
tarball from https://www.python.org/downloads/release/python-370/

Python then isn't viable currently for embedding inside applications 
(https://docs.python.org/3/extending/embedding.html). 3rd party app developers 
on macOS typically have a policy at least supporting back to N-1 or N-2'th OS, 
and in many cases it shouldn't be their dependencies that drive this. 

The other two functions require 10.13:
futimens
utimensat

Fortunately the -Wunguarded-availability warning is enabled which spits out 
warnings on which functions aren't available when targeting a min OS 
(MACOSX_DEPLOYMENT_TARGET)

Can't say I can contribute anything here unfortunately :(. I had to do 
something though, so I hacked the configure scripts and pyconfig.h to make sure 
the clock_* and the above functions I mentioned above weren't being used. 
getentropy was easy to fix more properly because it already has a fallback at 
runtime in case it's not working, so it was just an additional NULL check. 
Looks like the functions are weakly referenced when building to an older OS 
target.

A bad step in future direction would be to continue making "no promises" and 
start using functionality only available on 10.14, 10.15, etc without fallback.

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

sqlite3.dump._iterdump() access to the "sqlite_master" table Hum, I don't 
think that Python chose the name of this table. This issue should be addressed 
in SQLite, not in Python.

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, with these 3 PRs, I should have replaced most usages of master and slave 
terms.

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


--
components:  -2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
FreeBSD, IDLE, IO, Installation, Library (Lib), Regular Expressions, SSL, 
Tests, Tkinter, Unicode, Windows, XML, ctypes, email, macOS

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8555

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Yury Selivanov


Change by Yury Selivanov :


--
components:  -asyncio
nosy:  -yselivanov

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

(Oops, I didn't want to put so many people in the nosy list, sorry about the 
spam.)

--
nosy:  -Alex.Willmer, asvetlov, barry, docs@python, dstufft, eric.araujo, 
ezio.melotti, koobs, larry, mrabarnett, ned.deily, paul.moore, r.david.murray, 
ronaldoussoren, steve.dower, terry.reedy, 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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 012f5b968a738b15ae9b40c499a1c0778b0615a9 by Victor Stinner in 
branch 'master':
bpo-34605, libregrtest: Rename --slaveargs to --worker-args (GH-9099)
https://github.com/python/cpython/commit/012f5b968a738b15ae9b40c499a1c0778b0615a9


--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5e922658fb55734bf8b4c6246033ea93af172ff7 by Victor Stinner in 
branch 'master':
bpo-34605: Avoid master/slave terms (GH-9101)
https://github.com/python/cpython/commit/5e922658fb55734bf8b4c6246033ea93af172ff7


--

___
Python tracker 

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



[issue34563] invalid assert on big output of multiprocessing.Process

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Alexander Buchkovsky for the fix: it has been merged into 3.6, 3.7 and 
master branches. Thanks Oleksandr Buchkovskyi for the bug report!

--

I looked at the Python 2.7 code and it doesn't look to be impacted by this bug.

Modules/_multiprocessing/pipe_connection.c uses ReadFile() and PeekNamedPipe(), 
but the result type of the two C functions using it is not a PyObject* and 
conn_recv_string() looks good to me. Moreover, the type of the buflength 
parameter of conn_recv_string() is size_t, so there is no signed issue.

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

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


New submission from STINNER Victor :

For diversity reasons, it would be nice to try to avoid "master" and "slave" 
terminology which can be associated to slavery.

For more context, see:

* https://github.com/antirez/redis/issues/3185
* https://www.drupal.org/node/2275877
* https://issues.apache.org/jira/browse/COUCHDB-2248
* https://github.com/django/django/pull/2692

--
assignee: docs@python
components: 2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
FreeBSD, IDLE, IO, Installation, Interpreter Core, Library (Lib), Regular 
Expressions, SSL, Tests, Tkinter, Unicode, Windows, XML, asyncio, ctypes, 
email, macOS
messages: 324739
nosy: Alex.Willmer, asvetlov, barry, docs@python, dstufft, eric.araujo, 
ezio.melotti, koobs, larry, mrabarnett, ned.deily, paul.moore, r.david.murray, 
ronaldoussoren, steve.dower, terry.reedy, tim.golden, vstinner, yselivanov, 
zach.ware
priority: normal
severity: normal
status: open
title: Avoid master/slave terminology
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



[issue34354] Memory leak on _testCongestion

2018-09-07 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy: +yan12125

___
Python tracker 

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



[issue34587] test_socket: testCongestion() hangs on my Fedora 28

2018-09-07 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy: +yan12125

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Ammar Askar


Ammar Askar  added the comment:

Do you have examples of where this occurs? 

>From 
>https://github.com/python/cpython/search?p=1=master+slave_q=master+slave
> I really only found the openpty function, and the man pages/argument names 
>there already use this terminology so it wouldn't make much sense to change it 
>there.

--
nosy: +ammar2

___
Python tracker 

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



[issue34601] Typo: "which would rather raise MemoryError than give up", than or then?

2018-09-07 Thread Mark Dickinson


Mark Dickinson  added the comment:

See https://www.collinsdictionary.com/dictionary/english/would-rather for an 
example:

> I have no information one way or the other, but I would rather he do it
> than not do it.

--
nosy: +mark.dickinson
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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Ammar Askar


Ammar Askar  added the comment:

The libregrtest change looks good but I disagree on the pty/openpty changes. If 
you look at all the current Linux man pages and documentation, they follow the 
master/slave terminology. Generally, Python documentation for underlying os 
functions like fork, stat etc are kept short because the OS documentation is 
the ultimate resource for them. 

This change causes a deviation from the existing standard and will only serve 
to make things more confusing, I would suggest deferring it until the actual OS 
documentation reflects this change as well.

--

___
Python tracker 

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



[issue34513] test_multiprocessing_spawn fails on x86 Windows7 3.7 buildbot

2018-09-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

New failure on x86 Windows7 3.6 buildbot:

https://buildbot.python.org/all/#/builders/90/builds/519/steps/3/logs/stdio

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

nntplib.NNTP() has a slave() method, but this method sends a "SLAVE" command to 
the NNTP server. Changing that would require to modify the NNTP protocol, 
that's out of the scope of this issue...

RFC 977 "Network News Transfer Protocol" (NNTP)
Section 3.12: The SLAVE command
https://tools.ietf.org/html/rfc977

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

The doctest module has doctest.master symbol:
---
# For backward compatibility, a global instance of a DocTestRunner
# class, updated by testmod.
master = None
---

I'm not sure about changing this one. Here there is no slave, so it's less 
confusing.

But more generally, maybe it's time to remove this deprecated variable only 
kept for backward compatibility?

--

___
Python tracker 

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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

Tkinter and IDLE are full of "master" variables:

   master: parent for widgets.

It seems to be a keep concept of Tkinter windows.

--

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8549

___
Python tracker 

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



[issue34586] collections.ChainMap should have a get_where method

2018-09-07 Thread Zahari Dim


Zahari Dim  added the comment:

> ISTM that this is the wrong stage to perform validation of allowable values.  
> That should occur upstream when the underlying mappings are first created.  
> At that earlier stage it possible to give a more timely response to erroneous 
> input and there is access to more information (such as the line and row 
> number of an error in a configuration file).
>
> It doesn't make sense to me to defer value validation downstream after a 
> ChainMap instance has been formed and after a successful lookup has occurred. 
> That just complicates the task of tracing back to the root cause.

This is certainly the case in the situation where the validation only
depends on the value of the corresponding configuration entry, as it
admittedly does in the example above. However the example was
oversimplified insofar non trivial validation depends on the whole
ensemble configuration settings. For example taking the example
described at the top of

I think it would be useful to have an error message of the form:
f"User '{db_username}', defined in {configsetttings[user_index]} is
not found in database '{database}', defined in
{configsettings[database_index]}'

>
> > Maybe the method could be called ChainMap.search?
>
> That would be better than get_where().
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread miss-islington


miss-islington  added the comment:


New changeset f862f3abaed59b83763707ae529f0fe487961ba9 by Miss Islington (bot) 
in branch '3.7':
bpo-25750: fix refcounts in type_getattro() (GH-6118)
https://github.com/python/cpython/commit/f862f3abaed59b83763707ae529f0fe487961ba9


--
nosy: +miss-islington

___
Python tracker 

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



[issue34590] "Logging HOWTO" should share an example of best practices for using logging in a library

2018-09-07 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Then we could establish the "gold standard" for logging and write 
> about it in the HOWTO.

There really isn't a gold standard.  There are many widely varied logging 
practices, each adapted to the needs of the application.  The module is 
complicated primarily because there are so many legitimate techniques and 
reasons for using those techniques.

> (The documentation says "No handlers could be found for logger" 
> spam only happens pre-3.2, but some of my users at least think
> they see it in later Pythons.)

If you find an actual error in the docs, please make a specific report so that 
it can be confirmed and fixed.

--
assignee: docs@python -> vinay.sajip
nosy: +vinay.sajip
versions:  -Python 2.7, 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



[issue34594] Some tests use hardcoded errno values

2018-09-07 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +8551

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread Armin Rigo


Change by Armin Rigo :


--
nosy:  -arigo

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3ee07432f2e607cc6e7e6ea2d3695b672ceb1cea by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
bpo-25750: fix refcounts in type_getattro() (GH-6118) (GH-9088)
https://github.com/python/cpython/commit/3ee07432f2e607cc6e7e6ea2d3695b672ceb1cea


--

___
Python tracker 

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



[issue34586] collections.ChainMap should have a get_where method

2018-09-07 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I would argue that all of the examples would benefit from error
> checking done along the lines of the snippet above.

ISTM that this is the wrong stage to perform validation of allowable values.  
That should occur upstream when the underlying mappings are first created.  At 
that earlier stage it possible to give a more timely response to erroneous 
input and there is access to more information (such as the line and row number 
of an error in a configuration file).  

It doesn't make sense to me to defer value validation downstream after a 
ChainMap instance has been formed and after a successful lookup has occurred. 
That just complicates the task of tracing back to the root cause.

> Maybe the method could be called ChainMap.search?

That would be better than get_where().

--

___
Python tracker 

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



[issue34590] "Logging HOWTO" should share an example of best practices for using logging in a library

2018-09-07 Thread pms.coder


pms.coder  added the comment:

I would be happy to see such HOWTO, so we could relay on actual documentation 
instead of the "Internet".

I think the best approach would be to get those 10-20 questions you ( Nathaniel 
Manista) just asked and post them to python-dev mailing list, so senior 
developers/committers could answer them. 

Then we could establish the "gold standard" for logging and write about it in 
the HOWTO.

--
nosy: +pms.coder

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

The bug has been fixed in 2.7, 3.6, 3.7 and master branches. Thanks Jeroen 
Demeyer for your tenacity and hard work :-)

Let's see what we do with the unit test: PR 9084.

--

___
Python tracker 

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



[issue25750] tp_descr_get(self, obj, type) is called without owning a reference to "self"

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset bf2bd8f8a1d88de60c114de957f50fe2433e3937 by Victor Stinner in 
branch '2.7':
bpo-25750: fix refcounts in type_getattro() (GH-6118) (GH-9091)
https://github.com/python/cpython/commit/bf2bd8f8a1d88de60c114de957f50fe2433e3937


--

___
Python tracker 

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



[issue34594] Some tests use hardcoded errno values

2018-09-07 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +8550

___
Python tracker 

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



[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-07 Thread Martin Hosken


New submission from Martin Hosken :

This is a regression from python2 by being forced to use cElementTree.

I have code that uses iterparse to process an XML file, but I also want to 
process comments and so I have a comment handling function called by the parser 
during iterparse. Under python3 I can find no way to achieve the same thing:

```
parser = et.XMLParser(target=et.TreeBuilder())
parser.parser.CommentHandler = myCommentHandler
for event, elem in et.iterparse(fh, parser=parser):
...
```

Somewhat ugly but works in python2, but I can find no way to set a comment 
handler on the parser in python3.


1. There is no way(?) to get to xml.etree.ElementTree.XMLParser since the C 
implementation completely masks the python versions.
2. It is possible to create a subclass of TreeBuilder to add a comment method. 
But the C version XMLParser requires that its TreeBuilder not be a subclass, 
when used in iterparse.

The only solution I found was to copy the XMLParser code out of ElementTree 
into a private module and use that pure python implementation.

Suggested solutions:
1. Allow access to all the python implementations in ElementTree and not just 
Element.
2. Allow a comments method to be passed to the XMLParser on creation.

Thank you.

--
components: XML
messages: 324719
nosy: Martin Hosken
priority: normal
severity: normal
status: open
title: python3 regression ElementTree.iterparse() unable to capture comments
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



[issue34602] python3 resource.setrlimit strange behaviour under macOS

2018-09-07 Thread marche147


New submission from marche147 :

Consider the following code:

```
import resource
s, h = resource.getrlimit(resource.RLIMIT_STACK)
resource.setrlimit(resource.RLIMIT_STACK, (h, h))
```

Running this under macOS with python 3.6.5 gives the following exception:

```
bash-3.2$ uname -a
Darwin arch-osx 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 
2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64
bash-3.2$ cat test.py
import resource
s, h = resource.getrlimit(resource.RLIMIT_STACK)
resource.setrlimit(resource.RLIMIT_STACK, (h, h))
bash-3.2$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 3, in 
resource.setrlimit(resource.RLIMIT_STACK, (h, h))
ValueError: current limit exceeds maximum limit
```

Nevertheless, when using python 2.7.10 under the same environment, this code 
works perfectly without exceptions being thrown. Additionally, neither of these 
operations fail under the same circumstances :

```
bash-3.2$ cat test.c
#include 
#include 
#include 
#include 
#include 

int main() {
  struct rlimit rl;
  if(getrlimit(RLIMIT_STACK, ) < 0) {
perror("getrlimit");
exit(1);
  }

  rl.rlim_cur = rl.rlim_max;
  if(setrlimit(RLIMIT_STACK, ) < 0) {
perror("setrlimit");
exit(1);
  }
  return 0;
}
bash-3.2$ gcc -o test test.c
bash-3.2$ ./test
```

```
bash-3.2$ ulimit -s -H
65532
bash-3.2$ ulimit -s
8192
bash-3.2$ ulimit -s 65532
bash-3.2$ ulimit -s
65532
```

I have also tried to run the above-mentioned python script on linux, also it 
does not generate exceptions both on python2 (2.7.10) & python3 (3.6.5).

--
components: Library (Lib)
messages: 324731
nosy: marche147
priority: normal
severity: normal
status: open
title: python3 resource.setrlimit strange behaviour under macOS
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



[issue34605] Avoid master/slave terminology

2018-09-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Having said that, there are situations where words are used confusingly or 
inappropriately, and better choices are available.  (I am sometimes confused, 
for instance, by the use of 'client' and 'server'.)  In such situations, change 
can be justified without reference to private complaints.

--

___
Python tracker 

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



[issue33625] Release GIL for grp.getgr{nam, gid} and pwd.getpw{nam, uid}

2018-09-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue34486] "RuntimeError: release unlocked lock" when starting a thread

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This looks similar to to problems with the "with" statement: see issue29988 and 
issue34067. Except that there is no a "with" statement, and resolving that 
issues will not solve this issue.

--

___
Python tracker 

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



[issue34609] Idle Unitest

2018-09-07 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I cannot confirm this.  I tested 3.6.6 on Windows 10 with tem3.py containing

import unittest
print unittest

I ran this twice, without and with debug on.  The output:

 RESTART: F:\Python\a\tem3.py 

>>> 
[DEBUG ON]
>>> 
 RESTART: F:\Python\a\tem3.py 

[DEBUG ON]
>>>

On the second run, I hit the [Go] button on Debug Control.  The minimal program 
above needs to be tested with 3.6.6 or 3.7.0 on Linux.

--
nosy: +cheryl.sabella, taleinat

___
Python tracker 

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



[issue34546] Add encryption support to zipfile

2018-09-07 Thread Christian Heimes


Christian Heimes  added the comment:

-1 from me, too.

Serhiy already made a valid point and suggested a better alternative.

--

___
Python tracker 

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



[issue32055] Reconsider comparison chaining for containment tests

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This had not been discussed.

--

___
Python tracker 

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



[issue34606] Unable to read zip file with extra

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The value of the extra attribute is not an arbitrary bytes object. It is a 
sequence of blocks in the following format: 16-bit identifier followed by 
16-bit size of the block followed by the specified amount of bytes. Your 
example creates invalid ZIP file.

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



[issue34595] PyUnicode_FromFormat(): add %T format for an object type name

2018-09-07 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

IIRC there is similar issue or a discussion on one of mailing lists. But the 
idea about adding this feature on Python side too was considered. It would be 
better to find this discussion before pushing this change.

In some cases we have the type itself, not an instance. So it makes sense to 
make %T an equivalent of arg->tp_name instead of Py_TYPE(arg)->tp_name.

On Python side, you need to output either short name obj.__class__.__name__ or 
full qualified name obj.__class__.__module__ + '.' + obj.__class__.__qualname__ 
with exception that the module name should be omitted if it is 'builtins'.

obj.__class__.__qualname__ if obj.__class__.__module__ == 'builtins' else 
f'{obj.__class__.__module__}.{obj.__class__.__qualname__}'

The case of the module name '__main__' can be handled specially too.
Obviously it is desirable to have a more handy way of writing such expression.

On C side, the problem is that tp_name means different, depending of the kind 
of the type. In some cases it is a short name, in other cases it is a full 
qualified name. It is not easy to write a code that produces the same output in 
Python and C. I have added a helper _PyType_Name() that helps to solve a part 
of these issues. If you want to output a short name (just cls.__name__ in 
Python), use _PyType_Name(cls) instead of cls->tp_name. But this doesn't help 
for the case when you need to output a full qualified name.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

> Thank you for merging PRs Victor, but seems you have merged wrong PR for 2.7.

Oh. I didn't notice that there were two PRs for 2.7. Do you want to rebase your 
PR 9062 on 2.7, or revert the commit that I merged? It's up to you ;-)

I reopen the issue.

It seems like PR 8971 is also open.

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

___
Python tracker 

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



[issue30977] reduce uuid.UUID() memory footprint

2018-09-07 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +8560

___
Python tracker 

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



[issue34606] Unable to read zip file with extra

2018-09-07 Thread Kyle Altendorf


Kyle Altendorf  added the comment:

Python 3.7 works with 2-byte elements, I managed to find the wrong section in 
the doc-linked docs.

4.5 Extensible data fields
--

   4.5.1 In order to allow different programs and different types
   of information to be stored in the 'extra' field in .ZIP
   files, the following structure MUST be used for all
   programs storing data in this field:

   header1+data1 + header2+data2 . . .

   Each header should consist of:

   Header ID - 2 bytes
   Data Size - 2 bytes

   Note: all fields stored in Intel low-byte/high-byte order.


And the test showing it working.


import sys
import zipfile

print(sys.version)

fn = sys.argv[1]
print(fn)

options = {
'endianness': ('little', 'big'),
'header_element_bytes': (2, 4),
'additional_size': (0, 4, 4 + 4),
}

for endianness in options['endianness']:
for additional_size in options['additional_size']:
for header_element_bytes in options['header_element_bytes']:
print('\n\n --- trying endianness: {}, additional_size: {}, 
header_element_bytes: {}'.format(endianness, additional_size, 
header_element_bytes))
with zipfile.ZipFile(fn, 'w') as zf:
zi = zipfile.ZipInfo("0")
extra_data = b"hello, extra, and some more just to make it 
longer and such so yeah"
zi.extra = (
(42).to_bytes(header_element_bytes, endianness)
+ (len(extra_data) + 
additional_size).to_bytes(header_element_bytes, endianness)
+ extra_data
)
zf.writestr(zi, b"the real data")

try:
zipfile.ZipFile(fn)
except Exception as e:
print(e)
else:
print('success')


altendky@lt:~/twisted$ python3.7 ../z.py 37.py
3.7.0 (default, Jul  7 2018, 15:49:24)
[GCC 6.3.0 20170516]
37.py


 --- trying endianness: little, additional_size: 0, header_element_bytes: 2
success


 --- trying endianness: little, additional_size: 0, header_element_bytes: 4
Corrupt extra field 6568 (size=27756)


 --- trying endianness: little, additional_size: 4, header_element_bytes: 2
Corrupt extra field 002a (size=71)


 --- trying endianness: little, additional_size: 4, header_element_bytes: 4
Corrupt extra field 6568 (size=27756)


 --- trying endianness: little, additional_size: 8, header_element_bytes: 2
Corrupt extra field 002a (size=75)


 --- trying endianness: little, additional_size: 8, header_element_bytes: 4
Corrupt extra field 6568 (size=27756)


 --- trying endianness: big, additional_size: 0, header_element_bytes: 2
Corrupt extra field 2a00 (size=17152)


 --- trying endianness: big, additional_size: 0, header_element_bytes: 4
Corrupt extra field  (size=10752)


 --- trying endianness: big, additional_size: 4, header_element_bytes: 2
Corrupt extra field 2a00 (size=18176)


 --- trying endianness: big, additional_size: 4, header_element_bytes: 4
Corrupt extra field  (size=10752)


 --- trying endianness: big, additional_size: 8, header_element_bytes: 2
Corrupt extra field 2a00 (size=19200)


 --- trying endianness: big, additional_size: 8, header_element_bytes: 4
Corrupt extra field  (size=10752)

--

___
Python tracker 

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



[issue34546] Add encryption support to zipfile

2018-09-07 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue34606] Unable to read zip file with extra

2018-09-07 Thread Kyle Altendorf


Kyle Altendorf  added the comment:

Turns out the docs do document this.  My apologies.

https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

   4.3.11  Archive extra data record: 

archive extra data signature4 bytes  (0x08064b50)
extra field length  4 bytes
extra field data(variable size)

Aside from the discrepancy between 16-bits and 4 bytes, it seems like something 
should happen, even if it's something other than 'fixing' the code to handle 
the malformed data.  Isn't it a bug for zipfile to create a non-compliant file? 
 Shouldn't it either check or provide an interface by which a compliant file 
could sensibly be created?  It doesn't seem great to just expect users to 
rewrite this each time they call.

(42).to_bytes(4, 'little') + len(data).to_bytes(4, 'little') + data

or, should it be 'big'?  and would it be (len(data) + 4 + 4)?

--

___
Python tracker 

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



[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

2018-09-07 Thread Tal Einat


Tal Einat  added the comment:

I'm +1 on this optimization.

--
nosy: +taleinat

___
Python tracker 

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



[issue33625] Release GIL for grp.getgr{nam, gid} and pwd.getpw{nam, uid}

2018-09-07 Thread STINNER Victor


STINNER Victor  added the comment:

I was waiting for the encoding fix to close this issue, but bpo-34604 has been 
created.

--

___
Python tracker 

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



  1   2   >