[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

Note: I'm not entirely sold on my own argument though, as I believe at least 
Alpine Linux already interprets the empty locale as C.UTF-8, so it may make 
more sense to use your dynamic check with both the empty string and "POSIX", 
and only testing those locales if they get reported back as effectively 
configuring the "C" locale.

--

___
Python tracker 

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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

The essential problem in both this issue and issue 30672 is that the tests are 
currently incorporating some Linux-specific assumptions about ways to request 
the "C" locale.

In https://github.com/python/cpython/pull/4369, I've taken the approach of 
making the baseline tests only cover "C" and "invalid.ascii", and then 
explicitly *opt-in* to testing an empty locale and "POSIX" on Linux machines.

If that's enough to get the test passing on Cygwin, I'm inclined to leave it at 
that. Dynamically calculated test expectations always make me nervous, since 
it's all too easy to end up with bugs that impact both the test case and the 
expectation calculator in the same way, and hence end up with the test passing 
when it should really fail.

--

___
Python tracker 

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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Nick Coghlan

Change by Nick Coghlan :


--
pull_requests: +4322

___
Python tracker 

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



[issue31996] `setuptools.setup` parameter `py_modules` is undocumented

2017-11-10 Thread Luther Thompson

Luther Thompson  added the comment:

Thanks, done: https://github.com/pypa/python-packaging-user-guide/issues/397

--

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2017-11-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

Given the existing "gc.enable", "gc.disable" and "gc.isenabled" APIs, I'd 
suggest calling this one "gc.ensure_disabled": it ensures the GC is disabled in 
the with statement body, but only turns it back on at the end if it was 
previously enabled.

That same name would then be used all the way through the code and 
documentation.

--

___
Python tracker 

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



[issue32003] multiprocessing.Array("b", 1), multiprocessing.Array("c", 1 ) wrong value returned

2017-11-10 Thread Samuel Nwokenkwo

Samuel Nwokenkwo  added the comment:

To clarify

my expectation was something like this:

arr = multiprocessing.Array('c', 3) # type char

arr = "Fun" 

which is similar to c implementation:

char arr[3] = "Fun"

AND

arr =  multiprocessing.Array('b', 3) # type byte
arr = b'fun'

Also this website list 'c' as a data type supported:
https://svn.python.org/projects/python/trunk/Lib/multiprocessing/sharedctypes.py

--

___
Python tracker 

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



[issue32003] multiprocessing.Array("b", 1), multiprocessing.Array("c", 1 ) wrong value returned

2017-11-10 Thread Samuel Nwokenkwo

Samuel Nwokenkwo  added the comment:

I completely wrote the wrong code: 

So I'll copy and paste:


Scenario 1
import multiprocessing

br = multiprocessing.Array('c', 1)

br[0] = 's'

print(br[:])

Scenario 1 result = "TypeError: one character bytes, bytearray or integer 
expected"

-

Scenario 2
import multiprocessing

br = multiprocessing.Array('b', 1)

br[0] = 's'.encode()

print(br[:])

Scenario 2 results = "TypeError: an integer is required (got type bytes)"

---

I believe my confusion is that I am thinking more of the python data type byte, 
which takes b'', than C language data type byte (which takes numbers from -127 
to 128. This confusion is compounded when I do something like scenario 3:
---

import multiprocessing

br = multiprocessing.Array('c', 1)

br[0] = 's'.encode()

print(br[:])

scenario 3 results: b's'
--

In the first scenario passing 's' i get an error, even though by definition 's' 
is a c char data type.

--

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

OK, I've had a couple of days to become not-annoyed about this, and given the 
discovery that pytest doesn't currently enable DeprecationWarning by default 
(even though the default DeprecationWarning behaviour changed more than 7 years 
ago), I'm now prepared to write a short PEP explicitly defining our updated 
expectations around how deprecation warnings will be handled:

* Change the default warning filters so that DeprecationWarning is once again 
visible by default for code in __main__
* Clearly document the assumption that anything factored out into a support 
library will have a test suite. If developers choose not to do that, then 
they're on their own when it comes to deprecation warnings for the APIs they 
use, just as they're on their own in relation to maintaining the compatibility 
of their own APIs.
* Clearly document the assumption that test runners will override the 
interpreter's suitable-for-end-user-application defaults with defaults that are 
more appropriate for testing use cases
* Recommend that test runners also set this in the environment (so it's 
inherited by subprocesses), not just in the current process
* Clearly document "-We", "-Wi", "-Wd" as shorthands to override the default 
warnings filters with universal "error", "ignore" and "default" settings (right 
now you have to reverse engineer this from the warnings docs)
* Clearly document "PYTHONWARNINGS=error", "PYTHONWARNINGS=ignore", and 
"PYTHONWARNINGS=default" as the environmental equivalents (right now you have 
to reverse engineer this from the warnings docs)
* Explicitly recommend FutureWarning as the "always visible by default" 
alternative to DeprecationWarning
* Explicitly recommend PendingDeprecationWarning as the "never visible by 
default" alternative to DeprecationWarning

I suspect if we'd been clearer about our assumptions back when the change was 
made and advertised in the Python 2.7 What's New, we'd have had fewer problems 
in the time since (e.g. third party test runner developers would have been more 
likely to realise that we meant for them to make the same change that we made 
to unittest's defaults - re-reading 
https://docs.python.org/3/whatsnew/2.7.html#changes-to-the-handling-of-deprecation-warnings
 now, I'm no longer surprised they didn't catch that implication)

--

___
Python tracker 

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



[issue21149] logging._removeHandlerRef is not threadsafe during interpreter shutdown

2017-11-10 Thread Gregory P. Smith

Change by Gregory P. Smith :


--
pull_requests: +4321
stage: resolved -> patch review

___
Python tracker 

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



[issue32003] multiprocessing.Array("b", 1), multiprocessing.Array("c", 1 ) wrong value returned

2017-11-10 Thread Eryk Sun

Change by Eryk Sun :


--
components: +Library (Lib) -asyncio
type:  -> behavior

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2017-11-10 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Just to clarify the current situation: At this point, the contextmanager is 
referred as "disabled" in the C code but is exported as "Disabled" to the 
garbage collection module. The "gc_disabled" is the Python "equivalent" given 
by Raymond that is included in the documentation

--

___
Python tracker 

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



[issue21149] logging._removeHandlerRef is not threadsafe during interpreter shutdown

2017-11-10 Thread Gregory P. Smith

Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2017-11-10 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Sorry about that. The context manager is "gc.Disabled()", which I admit is 
probably a bad name. The documentation is an example of the "equivalent" Python 
code as stated by Raymond in the first comment but I see now that this will 
raise confusion. Please, can you indicate what will be a correct name for the 
context manager so I can update the PR?

--

___
Python tracker 

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



[issue21149] logging._removeHandlerRef is not threadsafe during interpreter shutdown

2017-11-10 Thread Yilei Yang

Yilei Yang  added the comment:

Here is a minimal example:

main.py:
from pkg_a import lib_a
pkg_a/__init__.py
pkg_a/lib_a.py
import logging
import sys
import pkg_a  # This is important
handler = logging.StreamHandler(sys.stderr)

It does not happen in Python 3 though (3.5.3 at least).

--
nosy: +yileiyang

___
Python tracker 

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



[issue32006] multiprocessing.Array 'c' code is not documented

2017-11-10 Thread Steven D'Aprano

New submission from Steven D'Aprano :

multiprocessing.Array is documented as taking the same character codes as 
array.array, but it also takes 'c' which is not documented.

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array
https://docs.python.org/3/library/array.html#module-array

--
assignee: docs@python
components: Documentation
messages: 306069
nosy: docs@python, steven.daprano
priority: normal
severity: normal
status: open
title: multiprocessing.Array 'c' code is not documented
type: behavior

___
Python tracker 

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



[issue31995] Set operations documentation error

2017-11-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I did understand your report.  IMO your "declaration of incorrectness" is due 
to an overly strict misreading of what the docs are trying to say and it does 
not reflect an understanding of what the in-place operators do in-general.   We 
could write an extra paragraph in the set documentation on this topic; however, 
I believe it would create confusion where none currently exists (i.e. no 
reported issues for 15+ years).   Also the discussion is somewhat generic to 
any type that doesn't specifically implement in-place operators.   In other 
words, I prefer to leave the doc as-is.

--
assignee: rhettinger -> 

___
Python tracker 

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



[issue31995] Set operations documentation error

2017-11-10 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
assignee:  -> rhettinger
priority: normal -> low
resolution:  -> wont fix

___
Python tracker 

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



[issue31995] Set operations documentation error

2017-11-10 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
status: open -> closed

___
Python tracker 

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



[issue32005] multiprocessing.Array misleading error message in slice assignment

2017-11-10 Thread Steven D'Aprano

Change by Steven D'Aprano :


--
title: mutliprocessing.Array misleading error message in slice assignment -> 
multiprocessing.Array misleading error message in slice assignment

___
Python tracker 

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



[issue31995] Set operations documentation error

2017-11-10 Thread Alexander Mentis

Alexander Mentis  added the comment:

I don't think you understood my bug.

That the augmented assignment operators work differently for set and frozenset 
is not the issue.

The issue is that the documentation says that the |=, &=, -=, ^= operators do 
not apply to immutable instances of frozenset. This is incorrect.

--
resolution: rejected -> 
status: closed -> open

___
Python tracker 

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



[issue32005] mutliprocessing.Array misleading error message in slice assignment

2017-11-10 Thread Steven D'Aprano

New submission from Steven D'Aprano :

multiprocessing.Array slice assignment claims to require a single character 
even if it requires more than one:

py> arr = multiprocessing.Array('c', 3)
py> arr[:] = b'xyz'  # works
py> arr[:] = 'xyz'
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.5/multiprocessing/sharedctypes.py", line 226, in 
__setitem__
self._obj[i] = value
TypeError: one character bytes, bytearray or integer expected

--
components: Library (Lib)
messages: 306066
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: mutliprocessing.Array misleading error message in slice assignment
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue31526] Allow setting timestamp in gzip-compressed tarfiles

2017-11-10 Thread Martin Panter

Martin Panter  added the comment:

Perhaps you can compress the tar file using the “gzip.GzipFile” class. It 
accepts a custom “mtime” parameter (see Issue 4272, added in 2.7 and 3.1+):

>>> gztar = BytesIO()
>>> tar = GzipFile(fileobj=gztar, mode="w", mtime=0)
>>> tarfile.open(fileobj=tar, mode="w|").close()
>>> tar.close()
>>> gztar.getvalue().hex()
'1f8b080002ffedc1010d00c2a0f74f6d0e37a0008037039ade1d270028'

However, “tarfile.open” accepts a “compresslevel” argument for two of the 
compressors, so you could argue it is okay to add another argument to pass to 
the gzip compressor.

--
nosy: +martin.panter

___
Python tracker 

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



[issue32003] multiprocessing.Array("b", 1), multiprocessing.Array("c", 1 ) wrong value returned

2017-11-10 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

I don't understand why you think they are the wrong values. What values were 
you expecting?

You have a byte array, you set the value to the  byte b's', which is 115, and 
you get 115. You have a (byte) character array, you set the value to the byte 
b's', and you get b's'. What were you expecting?

--
components: +asyncio -Library (Lib)
nosy: +steven.daprano -eryksun
type: behavior -> 

___
Python tracker 

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



[issue32004] Allow specifying code packing order in audioop adpcm functions

2017-11-10 Thread MosesofEgypt

New submission from MosesofEgypt :

--- Issue ---
audioop.adpcm2lin and audioop.lin2adpcm currently treat the high 4 bits of each 
byte as the first code and the low 4 as the second code. In practice this is 
often the opposite.
http://www.drdobbs.com/database/algorithm-alley/184410326
https://wiki.multimedia.cx/index.php/Microsoft_IMA_ADPCM

--- Steps to reproduce ---
Run the attached script to decompress the attached wav to two different 16bit 
signed pcm wav files. The "GOOD" one had the nibbles of each code swapped 
before being decoded, while the "BAD" one didnt.

--- Suggested fix ---
I propose an additional optional boolean parameter to these functions to 
specify which nibble is the first code and which is the second.

NOTE: I haven't compiled my changes to test as I do not know how to set up a 
cpython build environment. This commit is more intended to show how to 
implement the fix.
https://github.com/MosesofEgypt/cpython/commit/4a5ca65833ec79857f065546ae0d90661ce26f5f

--
files: adpcm_test.zip
messages: 306063
nosy: MosesofEgypt
priority: normal
severity: normal
status: open
title: Allow specifying code packing order in audioop adpcm functions
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47258/adpcm_test.zip

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Olivier Grisel

Olivier Grisel  added the comment:

I have tried to implement the direct write bypass for the C version of the 
pickler but I get a segfault in a Py_INCREF on obj during the call to  
memo_put(self, obj) after the call to _Pickler_write_large_bytes.

Here is the diff of my current version of the patch:

https://github.com/ogrisel/cpython/commit/4e093ad6993616a9f16e863b72bf2d2e37bc27b4

I am new to the Python C-API so I would appreciate some help on this one.

--

___
Python tracker 

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



[issue32003] multiprocessing.Array("b", 1), multiprocessing.Array("c", 1 ) wrong value returned

2017-11-10 Thread Eryk Sun

Eryk Sun  added the comment:

The values are correct for the given type codes, which should be the same as 
the corresponding type codes for the array and struct modules. Except the array 
module doesn't support the "c" type. 

However, assigning b's' to an index of a "b" type array should fail with a 
TypeError, so I don't think you're showing actual code. A "b" array value is a 
signed integer in the range [-128, 127]. Larger magnitude integers can be 
assigned, but they alias (wrap around) back to this range.

--
components: +Library (Lib) -asyncio
nosy: +eryksun
type:  -> behavior

___
Python tracker 

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



[issue31995] Set operations documentation error

2017-11-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

This is an artifact of how in-place operators work (which is a topic covered in 
the Library Reference).  It doesn't really have anything to do with frozensets 
specifically.  For example, you see the same effect with tuples which like 
frozensets are immutable and do not implement any of the in-place dunder 
methods:

>>> s = ('a', 'b', 'c')
>>> s += ('d', 'e')
>>> s
('a', 'b', 'c', 'd', 'e')

IIRC, this is the first time this has come-up in the 15 year history of sets, 
so I don't think there is a real problem to be solved.  At best, this should be 
a FAQ entry or relegated to StackOverflow.  I would prefer not to alter the set 
documentation because doing so would likely create confusion rather than solve 
it.

--
assignee: docs@python -> rhettinger
resolution:  -> rejected
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



[issue32001] @lru_cache needs to be called with ()

2017-11-10 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Marking this as rejected.  We specifically added a test and error message for 
this particular misuse of lru_cache.

--
resolution:  -> rejected
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



[issue28369] Raise RuntimeError when transport's FD is used with add_reader etc

2017-11-10 Thread Berker Peksag

Change by Berker Peksag :


--
pull_requests:  -1054

___
Python tracker 

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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-11-10 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you, Peter and Pablo.

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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-11-10 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 7abbddd88d4debe75b201145b6212afb7d93c457 by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-31824: Document default value of 'errors' parameters (GH-4328)
https://github.com/python/cpython/commit/7abbddd88d4debe75b201145b6212afb7d93c457


--

___
Python tracker 

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



[issue21149] logging._removeHandlerRef is not threadsafe during interpreter shutdown

2017-11-10 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

We're still seeing this (in 2.7.12, but the code at 2.7 head hasn't changed).  
In this case the RLock being used within _acquireLock() still exists but is an 
incomplete object by the time we use it.

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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-11-10 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4320

___
Python tracker 

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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-11-10 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset e184cfd7bf8bcfd160e3b611d4351ca3ce52d9e2 by Berker Peksag (Pablo 
Galindo) in branch 'master':
bpo-31824: Document default value of 'errors' parameters (GH-4328)
https://github.com/python/cpython/commit/e184cfd7bf8bcfd160e3b611d4351ca3ce52d9e2


--

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What is the name of the context manager? gc_disabled, disabled, or Disabled? I 
see different names in the PR and this confuses me.

--

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2017-11-10 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I just realize that the link I provided is incorrect. This is the correct one 
(also is the one that appears in this issue anyway):

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

--

___
Python tracker 

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



[issue31974] Cursor misbahavior with Tkinter 3.6.1/tk 8.5 Text on Mac Sierra

2017-11-10 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

3.7.0a2 is out now.  There will be an .0a3, .0a4, then .0b1 in January.  Ned is 
saying that at least the last of these will be compiled to work with 8.6.  Once 
that occurs, I would switch as most of the remaining changes before the .0 
release will be fixes to new features, which you can not use.  With respect to 
existing features, 3.7 should be as good as 3.6 as 3.7 has all of the bugfixes 
in 3.6 plus some that will only appear in the future 3.6.4 release.

Irv, when you reply by email, please delete the quoted previous message (except 
perhaps for a phrase being specifically addressed).

--

___
Python tracker 

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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-11-10 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I have updated the PR with the requested changes.

--

___
Python tracker 

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



[issue15606] re.VERBOSE whitespace behavior not completely documented

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Steven's patch is outdated since 71a0b43854164b6ada0026d90f241c987b54d019. But 
that commit missed that spaces are not ignored within tokens. PR 4366 fixes 
this by using the wording from Ezio's comments.

--
nosy: +zach.ware

___
Python tracker 

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



[issue15606] re.VERBOSE whitespace behavior not completely documented

2017-11-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue28369] Raise RuntimeError when transport's FD is used with add_reader etc

2017-11-10 Thread Yury Selivanov

Change by Yury Selivanov :


--
keywords: +patch
pull_requests: +4318

___
Python tracker 

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



[issue28369] Raise RuntimeError when transport's FD is used with add_reader etc

2017-11-10 Thread Yury Selivanov

Change by Yury Selivanov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue28369] Raise RuntimeError when transport's FD is used with add_reader etc

2017-11-10 Thread Yury Selivanov

Change by Yury Selivanov :


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

___
Python tracker 

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



[issue31976] Segfault when closing BufferedWriter from a different thread

2017-11-10 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue31976] Segfault when closing BufferedWriter from a different thread

2017-11-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thank you for posting this Benjamin.  As I said on the PR, I don't think I want 
to backport this to 3.6, as it is always delicate to reason about subclassing 
and threads.

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



[issue31976] Segfault when closing BufferedWriter from a different thread

2017-11-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 9703f092abc0259926d88c7855afeae4a78afc7d by Antoine Pitrou 
(benfogle) in branch 'master':
bpo-31976: Fix race condition when flushing a file is slow. (#4331)
https://github.com/python/cpython/commit/9703f092abc0259926d88c7855afeae4a78afc7d


--
nosy: +pitrou

___
Python tracker 

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



[issue31974] Cursor misbahavior with Tkinter 3.6.1/tk 8.5 Text on Mac Sierra

2017-11-10 Thread Irv Kalb

Irv Kalb  added the comment:

Hi Ned,

Thanks for your message.  But I want to make sure I understand what you are 
saying here.  

I am using absolutely vanilla Python 3.6 from python.org , 
but have upgraded to version 8.5.18  if ActiveState tk.  I was told that this 
version of Python would not work correctly with the current (8.6) version of 
tk.  So, I have not installed that.

Am I correct in understanding that this but is not fixable when using Python 
3.6?  (That's OK, I just want to make sure.)

It sounds like when Python 3.7 comes out, if I still see the bug, I could 
upgrade to ActiveState 8.6.7, and that combination should fix the problem.  Is 
that correct?

Thanks again,

Irv

> On Nov 10, 2017, at 7:00 AM, Ned Deily  wrote:
> 
> 
> Ned Deily  added the comment:
> 
> Thanks for the very helpful video, Irv.  It is definitely not a Python issue 
> as I am able to reproduce the positioning problem using the current 
> ActiveState Community Edition 8.6.6 and 8.5.18 macOS Wish shell text widget 
> demos (as long as I use spaces at the beginning of a line and not tabs).  
> However, the current MacPorts Tk which has been updated to 8.6.7 does not 
> seem to have this problem, so, if it was fixed in Tk, it was fixed fairly 
> recently.  The python.org 3.7 for macOS will use 8.6 by default prior to 
> feature code off.
> 
> --
> resolution:  -> third party
> stage:  -> resolved
> status: open -> closed
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue24641] Log type of unserializable value when raising JSON TypeError

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The idea about including a path to non-serializable object looks interesting 
(and it would be even more useful for pickling), but harder to implement.

--

___
Python tracker 

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



[issue24641] Log type of unserializable value when raising JSON TypeError

2017-11-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue24641] Log type of unserializable value when raising JSON TypeError

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This issue was partially fixed in issue26623. The error message for unsupported 
types now is `"Object of type '%s' is not JSON serializable" % 
o.__class__.__name__`.

But this change is not complete. The error message for non-string keys still 
contains the repr of a key. And the example for default() in the module 
docstring contains the repr of an object.

--
assignee:  -> serhiy.storchaka
stage: test needed -> 
versions: +Python 3.7 -Python 2.7, 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



[issue31994] json encoder exception could be better

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Actually it was fixed in issue26623.

--
superseder: Log type of unserializable value when raising JSON TypeError -> 
JSON encode: more informative error

___
Python tracker 

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



[issue31994] json encoder exception could be better

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is a duplicate of issue24641.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Log type of unserializable value when raising JSON TypeError

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Olivier Grisel

Olivier Grisel  added the comment:

BTW, I am looking at the C implementation at the moment. I think I can do it.

--

___
Python tracker 

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



[issue32001] @lru_cache needs to be called with ()

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

One such decorator was added in 3.7: xmlrpc.server.register_function (see 
issue7769). I don't think lru_cache should follow this example.

There are few cases in which such obscure decorators are more or less 
appropriate:

1. The function initially was not a decorator, and now it can be used as a 
decorator, but we need to pass additional optional arguments.

2. The decorator initially didn't take arguments, but we need to pass optional 
arguments now.

3. The majority of usages of the decorator don't take arguments.

Maybe needed to satisfy more than one of the above conditions.

--

___
Python tracker 

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



[issue32001] @lru_cache needs to be called with ()

2017-11-10 Thread Éric Araujo

Éric Araujo  added the comment:

I remember seeing code needed to make a decorator that works with and without 
parens and finding it quite obscure and confusing for a long time.  When you 
understand the distinction between, things become clear and simple again.  I 
like that the stdlib keeps that distinction.

We could change the doc to include an example without parameters.
We may also make sure to call lru_cache a decorator factory, with a glossary 
link or link to decorator reference doc.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue15606] re.VERBOSE whitespace behavior not completely documented

2017-11-10 Thread Kevin Shweh

Kevin Shweh  added the comment:

It looks to me like there are more situations than the patch lists where 
whitespace still separates tokens. For example, *? is a reluctant quantifier 
and * ? is a syntax error, even in verbose mode.

--
nosy: +Kevin Shweh

___
Python tracker 

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



[issue31985] Deprecate openfp() in aifc, sunau and wave

2017-11-10 Thread Brian Curtin

Brian Curtin  added the comment:


New changeset 9f914a01affc55abe799afc521ce71612bb495a5 by Brian Curtin in 
branch 'master':
bpo-31985: Deprecate openfp in aifc, sunau, and wave (#4344)
https://github.com/python/cpython/commit/9f914a01affc55abe799afc521ce71612bb495a5


--

___
Python tracker 

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



[issue32003] multiprocessing.Array("b", 1), multiprocessing.Array("c", 1 ) wrong value returned

2017-11-10 Thread Samuel Nwokenkwo

New submission from Samuel Nwokenkwo :

1st sequence:

arr = multiprocessing.Array("b", 1)  # byte type

arr[0] = 's'.encode()

print(arr[:]) 

result is [115]

2nd sequence:
arr = multiprocessing.Array("c", 1)  # character type

arr[0] = 's'.encode()

print(arr[:]) 

result is b's'

--
Wrong values for given types.

--
components: asyncio
messages: 306037
nosy: snwokenk, yselivanov
priority: normal
severity: normal
status: open
title: multiprocessing.Array("b", 1), multiprocessing.Array("c",1 )   wrong 
value returned
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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Erik Bray

Erik Bray  added the comment:

In my PR there's a behavior test for the default, so we don't have to hard-code 
that on a per-platform basis at least.  The C != POSIX thing I'm not sure you 
can easily test for.

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Nice! I have got virtually the same code as your intermediate variant, but your 
final variant event better!

--

___
Python tracker 

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



[issue31974] Cursor misbahavior with Tkinter 3.6.1/tk 8.5 Text on Mac Sierra

2017-11-10 Thread Ned Deily

Ned Deily  added the comment:

Thanks for the very helpful video, Irv.  It is definitely not a Python issue as 
I am able to reproduce the positioning problem using the current ActiveState 
Community Edition 8.6.6 and 8.5.18 macOS Wish shell text widget demos (as long 
as I use spaces at the beginning of a line and not tabs).  However, the current 
MacPorts Tk which has been updated to 8.6.7 does not seem to have this problem, 
so, if it was fixed in Tk, it was fixed fairly recently.  The python.org 3.7 
for macOS will use 8.6 by default prior to feature code off.

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Olivier Grisel

Olivier Grisel  added the comment:

Alright, the last version has now ~4% overhead for small bytes.

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Olivier Grisel

Olivier Grisel  added the comment:

Actually, I think this can still be improved while keeping it readable. Let me 
try again :)

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Olivier Grisel

Olivier Grisel  added the comment:

I have pushed a new version of the code that now has a 10% overhead for small 
bytes (instead of 40% previously).

It could be possible to optimize further but I think that would render the code 
much less readable so I would be tempted to keep it this way.

Please let me know what you think.

--

___
Python tracker 

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



[issue31992] Make iteration over dict_items yield namedtuples

2017-11-10 Thread R. David Murray

R. David Murray  added the comment:

This is not something it is worth complicating the dict API or collections for. 
 If you want the feature in your code, implement your subclass in your own 
utility library.

If you disagree with this decision, please bring it up on the python-ideas 
mailing list for further analysis, but I'm guessing you won't get much traction.

--
nosy: +r.david.murray
resolution:  -> rejected
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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This speeds up pickling large bytes objects.

$ ./python -m timeit -s 'import pickle; a = [bytes([i%256])*100 for i in 
range(256)]' 'with open("/dev/null", "wb") as f: pickle._dump(a, f)'
Unpatched:  10 loops, best of 5: 20.7 msec per loop
Patched:200 loops, best of 5: 1.12 msec per loop

But slows down pickling short bytes objects longer than 256 bytes (up to 40%).

$ ./python -m timeit -s 'import pickle; a = [bytes([i%256])*1000 for i in 
range(25600)]' 'with open("/dev/null", "wb") as f: pickle._dump(a, f)'
Unpatched:  5 loops, best of 5: 77.8 msec per loop
Patched:2 loops, best of 5: 98.5 msec per loop

$ ./python -m timeit -s 'import pickle; a = [bytes([i%256])*256 for i in 
range(10)]' 'with open("/dev/null", "wb") as f: pickle._dump(a, f)'
Unpatched:  1 loop, best of 5: 278 msec per loop
Patched:1 loop, best of 5: 382 msec per loop

Compare with:

$ ./python -m timeit -s 'import pickle; a = [bytes([i%256])*255 for i in 
range(10)]' 'with open("/dev/null", "wb") as f: pickle._dump(a, f)'
Unpatched:  1 loop, best of 5: 277 msec per loop
Patched:1 loop, best of 5: 273 msec per loop

I think the code should be optimized for decreasing an overhead of 
_write_many().

--

___
Python tracker 

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



[issue31992] Make iteration over dict_items yield namedtuples

2017-11-10 Thread Richard Neumann

Richard Neumann  added the comment:

Maybe there is no need to sacrifice performance, if a new, optional keyword 
argument would be introduced to dict.items():

def items(self, named=False):
if named:

else:


Currently I need to define a namedtuple everywhere I do this and starmap the 
dicts' items.

It'd be nice to have this option built-in or a new collections class like:

from collections import namedtuple
from itertools import starmap


DictItem = namedtuple('DictItem', ('key', 'value'))


class NamedDict(dict):
"""Dictionary that yields named tuples on item iterations."""

def items(self):
"""Yields DictItem named tuples."""
return starmap(DictItem, super().items())

--

___
Python tracker 

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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

OK, I'd been meaning to get back to refactoring those tests anyway, so 
assigning this to myself.

I'm thinking that the right way to go will be to give the test case a more 
explicit model of "expected platform behaviour" (initialised in setupModule), 
rather than having that be implicit in a bunch of conditionals scattered 
throughout the individual test cases.

Then we'd have at least the following cases:

- default is C, POSIX is an alias for C (most Linux distros)
- default is C, POSIX is a separate locale (*BSD)
- default is C.UTF-8 (Cygwin, potentially Android depending on exactly how we 
resolve that)

--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'll try to write the C implementation. Maybe it will use other heuristic.

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Olivier Grisel

Olivier Grisel  added the comment:

In my last comment, I also reported the user times (not spend in OS level disk 
access stuff): the code of the PR is on the order of 300-400ms while master is 
around 800ms or more.

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Actually the time varies too much between runs. 1.641s ... 8.475s ... 12.645s

--

___
Python tracker 

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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Erik Bray

Erik Bray  added the comment:

Yes, I looked at some of the other issues pertaining to this, but it wasn't 
immediately apparent how to kill multiple birds with one stone, so here I just 
focused on this one assumption.

--

___
Python tracker 

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



[issue31999] test_venv failed when the zlib module is not available

2017-11-10 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



[issue31530] Python 2.7 readahead feature of file objects is not thread safe

2017-11-10 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



[issue31530] Python 2.7 readahead feature of file objects is not thread safe

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 6401e5671781eb217ee1afb4603cc0d1b0367ae6 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-31530: Stop crashes when iterating over a file on multiple threads. 
(#3672)
https://github.com/python/cpython/commit/6401e5671781eb217ee1afb4603cc0d1b0367ae6


--

___
Python tracker 

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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

Issue 30672 is potentially related here - some of the test cases are already 
disabled on Mac OS X and other *BSD systems since the tests assume that C & 
POSIX are aliases of each other.

I've also added Xavier to the nosy list, since the current implementation and 
tests aren't quite right for Android either and it would be good to come up 
with a unified solution to more robust platform feature detection: 
https://bugs.python.org/issue28180#msg305850

--
nosy: +xdegaye

___
Python tracker 

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



[issue31999] test_venv failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 7997fa2e2159cfce0cfbe985a953174ac86694a4 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31999: Fix test_venv in case the zlib module is not available. (GH-4359) 
(#4360)
https://github.com/python/cpython/commit/7997fa2e2159cfce0cfbe985a953174ac86694a4


--

___
Python tracker 

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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Erik Bray

Change by Erik Bray :


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

___
Python tracker 

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



[issue32002] test_c_locale_coercion fails when the default LC_CTYPE != "C"

2017-11-10 Thread Erik Bray

New submission from Erik Bray :

Several of the tests in test_c_locale_coercion (particularly 
LocaleCoercionTests._check_c_locale_coercion) tend to assume that the system 
default locale used when setting setlocale(category, "") and when all the 
relevant environment variables are empty/blank will be the "C"/"POSIX" locale.

While this is often true POSIX does not require this to be the case.  For 
example on Cygwin it already defaults to "C.UTF-8", so these tests fail because 
they assume the legacy coercion will be used, when it isn't (e.g. the LC_CTYPE 
environment variable does not get forced to "C.UTF-8").  In principle this can 
affect any platform, however, that chooses a different default.

--
components: Tests
messages: 306019
nosy: erik.bray, ncoghlan
priority: normal
severity: normal
status: open
title: test_c_locale_coercion fails when the default LC_CTYPE != "C"
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



[issue32001] @lru_cache needs to be called with ()

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm -1. The beginner can make use lru_cache incorrectly the first time, but 
nobody will make this mistake twice. It is not worth to complicate the code (by 
the way, your code contains a bug) for saving from at most one mistake for all 
life.

"Special cases aren't special enough to break the rules."

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue31222] datetime.py implementation of .replace inconsistent with C implementation

2017-11-10 Thread STINNER Victor

STINNER Victor  added the comment:

Thanks Paul Ganssle for the bugfix! I merged your PR and backported it to 
Python 3.6. (Python 3.5 doesn't accept bugfixes anymore.)

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

___
Python tracker 

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



[issue32001] @lru_cache needs to be called with ()

2017-11-10 Thread Tom Hale

New submission from Tom Hale :

This comes from a question I raised on StackOverflow:
https://stackoverflow.com/q/47218313/5353461

I've copied the text below

=
=


The [documentation for 
`lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache)
 gives the function definition:

> @functools.lru_cache(maxsize=128, typed=False)

This says to me that `maxsize` is optional.

However, it doesn't like being called without an argument:

Python 3.6.3 (default, Oct 24 2017, 14:48:20) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> @functools.lru_cache
... def f(): ...
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/functools.py", line 477, in lru_cache
raise TypeError('Expected maxsize to be an integer or None')
TypeError: Expected maxsize to be an integer or None
 >>> 

Calling with an argument is fine:

>>> @functools.lru_cache(8)
... def f(): ...
... 
>>> 

Am I misreading the documentation?

=
=

The answer presented this solution:

if callable(maxsize):
def decorating_function(user_function):
wrapper = _lru_cache_wrapper(user_function, maxsize, typed, 
_CacheInfo)
return update_wrapper(wrapper, user_function)
return decorating_function(max_size) # yes, max_size is the function in 
this case O:)


=
=

Would you accept a PR based on this solution?

--
messages: 306016
nosy: ataraxy
priority: normal
severity: normal
status: open
title: @lru_cache needs to be called with ()

___
Python tracker 

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



[issue31998] test_zipapp failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue31998] test_zipapp failed when the zlib module is not available

2017-11-10 Thread Paul Moore

Paul Moore  added the comment:

Good catch, thanks Serhiy!

--

___
Python tracker 

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



[issue31999] test_venv failed when the zlib module is not available

2017-11-10 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4315

___
Python tracker 

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



[issue31998] test_zipapp failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset a1718bc7e0455ec5019e800d4172947bb4a07962 by Serhiy Storchaka in 
branch 'master':
bpo-31998: Fix test_zipapp in case the zlib module is not available. (#4358)
https://github.com/python/cpython/commit/a1718bc7e0455ec5019e800d4172947bb4a07962


--

___
Python tracker 

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



[issue31999] test_venv failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 5e0df74b3bc6391e9a7eba0fd84531ed99a78ae9 by Serhiy Storchaka in 
branch 'master':
bpo-31999: Fix test_venv in case the zlib module is not available. (#4359)
https://github.com/python/cpython/commit/5e0df74b3bc6391e9a7eba0fd84531ed99a78ae9


--

___
Python tracker 

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



[issue31988] Saving bytearray to binary plist file doesn't work

2017-11-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue31380] test_undecodable_filename() in Lib/test/test_httpservers.py broken on APFS

2017-11-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
components: +Tests
type: crash -> behavior
versions:  -Python 3.3, 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



[issue32000] test_undecodable_filename in test_httpservers failed on Mac OS X

2017-11-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Duplicate of issue31380.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> test_undecodable_filename() in Lib/test/test_httpservers.py 
broken on APFS

___
Python tracker 

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



[issue32000] test_undecodable_filename in test_httpservers failed on Mac OS X

2017-11-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

http://buildbot.python.org/all/#/builders/14/builds/160/steps/4/logs/stdio
==
ERROR: test_undecodable_filename 
(test.test_httpservers.SimpleHTTPServerTestCase)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/support/__init__.py",
 line 598, in wrapper
return func(*args, **kw)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_httpservers.py",
 line 395, in test_undecodable_filename
with open(os.path.join(self.tempdir, filename), 'wb') as f:
OSError: [Errno 92] Illegal byte sequence: 
'/var/folders/sy/9hwmqyx14s11577cvgzwf2v4gt/T/tmp0hrc3ckd/@test_54539_tmp\udce7w\udcf0.txt'
--

--
components: Tests, macOS
messages: 306011
nosy: ned.deily, ronaldoussoren, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_undecodable_filename in test_httpservers failed on Mac OS X
type: behavior
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



[issue31999] test_venv failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue31998] test_zipapp failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue31999] test_venv failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

http://buildbot.python.org/all/#/builders/14/builds/160/steps/4/logs/stdio
==
FAIL: test_with_pip (test.test_venv.EnsurePipTest)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_venv.py", 
line 363, in do_test_with_pip
with_pip=True)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_venv.py", 
line 56, in run_with_capture
func(*args, **kwargs)
subprocess.CalledProcessError: Command 
'['/private/var/folders/sy/9hwmqyx14s11577cvgzwf2v4gt/T/tmpljv28gk_/bin/python.exe',
 '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit 
status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_venv.py", 
line 421, in test_with_pip
self.do_test_with_pip(False)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_venv.py", 
line 369, in do_test_with_pip
self.fail(msg.format(exc, details))
AssertionError: Command 
'['/private/var/folders/sy/9hwmqyx14s11577cvgzwf2v4gt/T/tmpljv28gk_/bin/python.exe',
 '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit 
status 1.
**Subprocess Output**
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/runpy.py", 
line 193, in _run_module_as_main
"__main__", mod_spec)
  File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/runpy.py", 
line 85, in _run_code
exec(code, run_globals)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/ensurepip/__main__.py",
 line 5, in 
sys.exit(ensurepip._main())
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/ensurepip/__init__.py",
 line 204, in _main
default_pip=args.default_pip,
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/ensurepip/__init__.py",
 line 117, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/ensurepip/__init__.py",
 line 27, in _run_pip
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
--

--
assignee: serhiy.storchaka
components: Tests
messages: 306010
nosy: serhiy.storchaka, vinay.sajip
priority: normal
severity: normal
stage: needs patch
status: open
title: test_venv failed when the zlib module is not available
type: behavior
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



[issue31998] test_zipapp failed when the zlib module is not available

2017-11-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

http://buildbot.python.org/all/#/builders/14/builds/160/steps/4/logs/stdio
==
ERROR: test_create_archive_with_compression (test.test_zipapp.ZipAppTest)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_zipapp.py",
 line 111, in test_create_archive_with_compression
zipapp.create_archive(source, target, compressed=True)
  File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/zipapp.py", 
line 138, in create_archive
with zipfile.ZipFile(fd, 'w', compression=compression) as z:
  File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/zipfile.py", 
line 1061, in __init__
_check_compression(compression)
  File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/zipfile.py", 
line 644, in _check_compression
"Compression requires the (missing) zlib module")
RuntimeError: Compression requires the (missing) zlib module
--

--
assignee: serhiy.storchaka
components: Tests
messages: 306009
nosy: paul.moore, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: test_zipapp failed when the zlib module is not available
type: behavior
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