[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-17 Thread Xiang Zhang

Xiang Zhang added the comment:

> The cleanest way to refactor and fix this that comes to mind would be to make 
> static _get_object_name() and _add_methods_to_object() functions in 
> moduleobject.c (which omit any strict type checks), and then call those from 
> PyModule_GetNameObject and PyModule_AddFunctions with the explicit typecheck.

That's one solution. How about loosing PyModule_GetNameObject's constraint? Let 
it accept non-ModuleType objects? Actually without the constraint of 
PyModule_GetNameObject, PyModule_AddFunctions can handle non-ModuleType objects.

--

___
Python tracker 

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



[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Loosening the constraint on PyModule_GetNameObject would indeed work, but it 
means the code still has a readability problem: the convention in the C API is 
that officially ducktyped APIs use the PyObject_* prefix, or one of the other 
abstract protocols (PyNumber_*, PyMapping_*, etc), rather than a concrete type 
name like PyModule_*. Relying on folks to "just know" that these particular 
APIs deliberately don't enforce the type constraint is a recipe for future 
confusion, even if it's documented that way.

Such a change also has potential ripple effects on other implementations that 
emulate the C API, and hence isn't something I'd be comfortable with changing 
in a maintenance release, whereas fixing the implementation to match the PEP 
could be done for the next 3.5.x update.

--

___
Python tracker 

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



[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-17 Thread Xiang Zhang

Xiang Zhang added the comment:

Nice point. I'll write a patch to fix this these days.

--

___
Python tracker 

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



[issue27784] Random failure of test_TCPServer() of test.test_socketserver.SocketServerTest and test_handle_accept() of test.test_asyncore.TestAPI_UseIPv6Select on FreeBSD buildbots

2016-08-17 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/4760/steps/test/logs/stdio

test_handle_accept (test.test_asyncore.TestAPI_UseIPv6Select) ... ERROR

==
ERROR: test_handle_accept (test.test_asyncore.TestAPI_UseIPv6Select)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_asyncore.py",
 line 500, in tearDown
asyncore.close_all()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", 
line 561, in close_all
x.close()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/asyncore.py", 
line 397, in close
self.socket.close()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socket.py", 
line 407, in close
self._real_close()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socket.py", 
line 401, in _real_close
_ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

--


0:15:27 [319/402/4] test_socketserver failed -- running: test_tokenize (190 
sec), test_datetime (279 sec), test_tools (194 sec)
(...)
test_TCPServer (test.test_socketserver.SocketServerTest) ... creating server
ADDR = ('127.0.0.1', 42875)
CLASS = 
server running
test client 0
test client 1
Exception in thread  serving:
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/threading.py", 
line 916, in _bootstrap_inner
self.run()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/threading.py", 
line 864, in run
self._target(*self._args, **self._kwargs)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socketserver.py", line 
238, in serve_forever
self._handle_request_noblock()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socketserver.py", line 
319, in _handle_request_noblock
self.handle_error(request, client_address)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socketserver.py", line 
317, in _handle_request_noblock
self.process_request(request, client_address)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socketserver.py", line 
349, in process_request
self.shutdown_request(request)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socketserver.py", line 
510, in shutdown_request
self.close_request(request)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socketserver.py", line 
514, in close_request
request.close()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socket.py", 
line 407, in close
self._real_close()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/socket.py", 
line 401, in _real_close
_ss.close(self)
ConnectionResetError: [Errno 54] Connection reset by peer

ERROR
/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/unittest/case.py:628: 
ResourceWarning: unclosed 
  outcome.errors.clear()
/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/unittest/case.py:628: 
ResourceWarning: unclosed 
  outcome.errors.clear()
(...)
==
ERROR: test_TCPServer (test.test_socketserver.SocketServerTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_socketserver.py",
 line 175, in test_TCPServer
self.stream_examine)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/support/__init__.py",
 line 1956, in decorator
return func(*args)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_socketserver.py",
 line 141, in run_server
testfunc(svrcls.address_family, addr)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_socketserver.py",
 line 153, in stream_examine
buf = data = receive(s, 100)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_socketserver.py",
 line 46, in receive
raise RuntimeError("timed out on %r" % (sock,))
RuntimeError: timed out on 

--
Ran 25 tests in 25.825s

--
messages: 272910
nosy: haypo
priority: normal
severity: normal
status: open
title: Random failure of test_TCPServer() of 
test.test_socketserver.SocketServerTest and test_handle_accept() of 
test.test_asyncore.TestAPI_UseIPv6Select on FreeBSD buildbots

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bu

[issue27784] Random failure of test_TCPServer() of test.test_socketserver.SocketServerTest and test_handle_accept() of test.test_asyncore.TestAPI_UseIPv6Select on FreeBSD buildbots

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +koobs

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

"Just for fun, here's a recipe for a correctly-rounded nth root operation for 
positive finite floats. I'm not suggesting using this in the business logic: 
it's likely way too slow (especially for large n), but it may have a use in the 
tests."

I don't know well the statistics module, but it looks like it doesn't use 
directly floats, more a somehow higher level type of numbers to try to reduce 
rounding errors. For me, the math module is a thin wrapper on C library math 
functions, except of a few functions specific to Python like math.factorial. 
But the statistics module is at a higher level. Maybe we should draw a line 
between accuracy and speed. For example, explain in the statistics module that 
the module is designed for accuracy?

Sorry if I completly misunderstood the design of the statistics module :-)

--

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

About tradeoff, would it be possible to add an option to choose the quality of 
the accuracy? For example, a flag to choose between "fast nth root" or 
"accurate nth root".

Python already has two kind of numbers: Decimal and float. Maybe the "flag" 
should be the type of input numbers, Decimal or float?

I'm asking because I looked at http://lipforge.ens-lyon.fr/www/crlibm/ a few 
years ago, and such library is designed for accuracy, not for speed. crlibm is 
based on the scslib library which compose a number using multiple float numbers 
to get a better precision. To get correct rounding, crlibm requires more loop 
iterations and more floating point number operations, so as expected, it is 
slower.

FYI my old blog article (in french!): 
http://www.haypocalc.com/blog/index.php/2009/02/20/188-bibliotheque-mathematique-arrondi-exact-crlibm

--

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-17 Thread koobs

koobs added the comment:

For posterity, the following failure was observed on all (9/10/11(current) 
FreeBSD buildbots:

==
FAIL: testFraction (test.test_statistics.Test_Nth_Root)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd9/build/Lib/test/test_statistics.py",
 line 1247, in testFraction
self.assertEqual(self.nroot(x**12, 12), float(x))
AssertionError: 1.1865 != 1.1868

--
nosy: +koobs

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Just to share my little experience with rounding numbers.

Last years, I worked on a API to convert timestamps between float and integers, 
the private "PyTime C API":

   https://haypo.github.io/pytime.html

At the beginning, I used various floatting point numbers which looks fine in 
decimal. But quickly, I got rounding issues on various buildbots. After many 
years fighting against compilers and trying to write a complete test suite, I 
decided to only use numbers which can be stored exactly in IEEE 754:

if use_float:
# numbers with an exact representation in IEEE 754 (base 2)
for pow2 in (3, 7, 10, 15):
ns = 2.0 ** (-pow2)
ns_timestamps.extend((-ns, ns))

If you are curious, look at CPyTimeTestCase, TestCPyTime and TestOldPyTime 
classes in Lib/test/test_time.py.

At the end, I decided to reimplement each conversion function in pure Python 
using decimal.Decimal and compare the result with the C implementation. It 
makes the unit tests shorter and simpler.

--

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread Jeremy Kloth

Changes by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue27785] Module platform: Versions of Windows

2016-08-17 Thread squish_user

New submission from squish_user:

I use the module 'platform' to get information on the system my script is 
executed. I have 4 different operating systems in use: Windows 7, Windows 8, 
Windows 8.1 and Windows 10.

By using the module platform version 1.0.3 I get the following results by
platform.version().startswith:
Windows 7: 6.1
Windows 8: 6.2
Windows 8.1: 6.3
Windows 10: 10.0

I upgraded the module platform to version 1.0.7 (delivered with the 
squish-version squish-6.0.3-qt56x-win32-msvc12)

Now I get the following results:
platform.version()
Windows 7: 6.1.7601
Windows 8: 6.2.9200
Windows 8.1: 6.2.9200
Windows 10: 6.2.9200

So there is no longer a difference between Windows 8 and Windows 10.

--
components: Library (Lib)
messages: 272915
nosy: lemburg, squish_user
priority: normal
severity: normal
status: open
title: Module platform: Versions of Windows
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Would it be acceptable for you to add a new option to switch to UTF-8 in Python 
3.6, and discuss later if it's ok to enable it by default?

In the python-ideas threed, you wrote that Windows allow surrogate characters 
in filenames, but not the UTF-8/strict Python codec. Would it make sense to use 
UTF-8/surrogatepass codec to avoid any unicode error?

--
nosy: +haypo

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Steve Dower: Please don't use git format for diff, or the bug tracker is unable 
to create reviews. I regenerated the patch.

By the way, you introduced a bug in posix_do_stat(): you added a new "else" in 
the !MS_WINDOWS path which leads to a compilation error. I fixed it.

--
Added file: http://bugs.python.org/file44131/fsencoding.diff

___
Python tracker 

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



[issue27749] multprocessing errors on WindowsWriteFile() argument 1 must be int, not None; OSError: handle is closed

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
title: python 3.5.2 maybe crash in windows -> multprocessing errors on 
WindowsWriteFile() argument 1 must be int, not None; OSError: handle is closed

___
Python tracker 

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



[issue27749] multprocessing errors on Windows: WriteFile() argument 1 must be int, not None; OSError: handle is closed

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
title: multprocessing errors on WindowsWriteFile() argument 1 must be int, not 
None; OSError: handle is closed -> multprocessing errors on Windows: 
WriteFile() argument 1 must be int, not None; OSError: handle is closed

___
Python tracker 

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



[issue26331] PEP 515: Tokenizer: allow underscores for grouping in numeric literals

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Tokenizer: allow underscores for grouping in numeric literals -> PEP 
515: Tokenizer: allow underscores for grouping in numeric literals

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

I reviewed AF_ALG-kernel-crypto-support-for-socket-module.patch.

--
nosy: +haypo

___
Python tracker 

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



[issue26200] SETREF adds unnecessary work in some cases

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> Also, putting a function call inside a macro is a worrisome practice in C. 

I conccur with Raymond: it can be very painful if you get a segfault on such 
line. What is crashing? The function call? DECREF? INCREF? something else?

It's also more painful to debug such code in gdb step by step.

I dislike py_setref_extra.patch. I prefer more verbose C code, easy to debug.

--
nosy: +haypo

___
Python tracker 

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



[issue16764] Make zlib accept keyword-arguments

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Oops, I reviewed the patch before seeing that Serhiy already pushed it :-) 
Ignore my comment.

--
nosy: +haypo

___
Python tracker 

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



[issue27726] ctags -t does not exists in Makefile.pre.in

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue27726] ctags -t does not exists in Makefile.pre.in

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Thanks Stéphane for your fix.

--
nosy: +haypo

___
Python tracker 

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



[issue27726] ctags -t does not exists in Makefile.pre.in

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Oops, I didn't mention the issue number in the change.

changeset:   102724:8455902b3b8e
tag: tip
user:Victor Stinner 
date:Wed Aug 17 13:51:52 2016 +0200
files:   Makefile.pre.in
description:
"make tags": remove -t option of ctags

The option was kept for backward compatibility, but it was completly removed
recently. Patch written by Stéphane Wirtel.

--

___
Python tracker 

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



[issue27726] ctags -t does not exists in Makefile.pre.in

2016-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cbe87a9a0cf2 by Victor Stinner in branch 'default':
Fix "make tags": set locale to C to call sort
https://hg.python.org/cpython/rev/cbe87a9a0cf2

--
nosy: +python-dev

___
Python tracker 

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



[issue27726] ctags -t does not exists in Makefile.pre.in

2016-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed95e9ca2699 by Victor Stinner in branch '3.5':
Issue #27726: Fix "make tags"
https://hg.python.org/cpython/rev/ed95e9ca2699

--

___
Python tracker 

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



[issue24853] Py_Finalize doesn't clean up PyImport_Inittab

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> This means initialize/run script/finalize will crash the second time, since 
> the inittab can have stale entries.

Sorry, I don't understand. inittab: do you mean _PyImport_Inittab defined in 
Modules/config.c or PC/config.c? This table is constant, no?

Are you able to reproduce a crash?

I suggest to close the issue as not a bug :-p

--
nosy: +haypo

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

I really like the idea of IntFlags.

--
nosy: +haypo
title: Add Flags and IntFlags -> enum: Add Flags and IntFlags

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

I expected better repr for such code:

>>> socket.SOCK_STREAM | socket.SOCK_CLOEXEC
524289
>>> os.O_RDONLY | os.O_APPEND
1024

--

___
Python tracker 

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



[issue10976] accept bytes in json.loads()

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
title: json.loads() raises TypeError on bytes object -> accept bytes in 
json.loads()

___
Python tracker 

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



[issue27765] Accept UTF-8 encoded bytes as input to json.loads()

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
resolution:  -> duplicate
status: open -> closed
superseder:  -> accept bytes in json.loads()

___
Python tracker 

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



[issue10976] accept bytes in json.loads()

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue27706] Random.seed, whose purpose is purportedly determinism, behaves non-deterministically with strings due to hash randomization

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

"Right now the way to work around this is to get some deterministic hash from 
your string; one mechanism being a truncated SHA256 hash, ..."

It looks like I missed something. Lib/random.py already computes the SHA-512 
hash of you pass a string to random.Random constructor?

Using a string as a seed for random.Random already works as expected in Python 
3.6:

haypo@selma$ python3 -c "import random; r=random.Random('abc'); 
print(''.join(map(str, (r.randrange(10) for x in range(10, hash('abc'))"
8755240310 6396067846301608395
haypo@selma$ python3 -c "import random; r=random.Random('abc'); 
print(''.join(map(str, (r.randrange(10) for x in range(10, hash('abc'))"
8755240310 -1771227904188177035
haypo@selma$ python3 -c "import random; r=random.Random('abc'); 
print(''.join(map(str, (r.randrange(10) for x in range(10, hash('abc'))"
8755240310 1726464324144904308
haypo@selma$ python3 -c "import random; r=random.Random('abc'); 
print(''.join(map(str, (r.randrange(10) for x in range(10, hash('abc'))"
8755240310 2069899884777593571
haypo@selma$ python3 -c "import random; r=random.Random('abc'); 
print(''.join(map(str, (r.randrange(10) for x in range(10, hash('abc'))"
8755240310 -8244933646981095152
haypo@selma$ python3 -c "import random; r=random.Random('abc'); 
print(''.join(map(str, (r.randrange(10) for x in range(10, hash('abc'))"
8755240310 -3269879388324739111

It was already the case in Python 2.7.

--
nosy: +haypo

___
Python tracker 

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



[issue10976] accept bytes in json.loads()

2016-08-17 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue27599] Buffer overrun in binascii

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-08-17 Thread Mark Dickinson

Mark Dickinson added the comment:

Victor: by "way too slow", I really *do* mean way too slow. :-)

floor_nroot does arithmetic with integers of bit-length approximately 54*n. For 
small n, that's fine, but if someone tried to take the geometric mean of a list 
of 5 values (which it seems to me should be a perfectly reasonable 
use-case), floor_nroot would then be trying to do computations with 
multi-million-bit integers. The `a**(n-1)` operation in particular would be a 
killer for large `n`.

--

___
Python tracker 

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



[issue27574] Faster parsing keyword arguments

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

The issue can now be closed no?

--

___
Python tracker 

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



[issue27765] Accept UTF-8 encoded bytes as input to json.loads()

2016-08-17 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: needs patch -> resolved

___
Python tracker 

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



[issue26741] subprocess.Popen should emit a ResourceWarning in destructor if the process is still running

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Oops, I forget to close the issue.

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

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-17 Thread John Hagen

John Hagen added the comment:

@Raymond, you raise valid concerns to be sure.  Hoping we can work something 
out.

@Ethan, what are your thoughts?


It's not just C that has enums where you can define a unique group of names and 
omit the values for clarity when they are not significant:  

C++: http://en.cppreference.com/w/cpp/language/enum
C#: https://msdn.microsoft.com/en-us/library/sbbt4032.aspx
Java: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
Rust: https://doc.rust-lang.org/book/enums.html

In my experience this is the most common and simple use case for enums.

Raymond, what are your thoughts about the version of AutoEnum that requires 
that a bare tuple be used as the value.  It has been in the Python docs since 
3.4 and was actually the original request of this issue: 
https://docs.python.org/library/enum.html#autonumber

It avoids many of the concerns that you've raised while still providing a way 
to create Enums in the normal class declaration method users would expect with 
a minimum amount of boilerplate.  Note that normally you want to use 
@enum.unique with a normal Enum, but AutoEnum also allows you to omit that 
boilerplate as you can't accidentally alias the values.

@enum.unique
class Color(enum.Enum):
aquamarine = 1
blue = 2
fushia = 3
# inserting a member here (perhaps because it's clearest to keep these in 
alphabetic order)
# results in having to increment all following members
...
green = 40
red = 41

vs.

class Color(enum.AutoEnum):
aquamarine = ()
blue = ()
fushia = ()
# inserting a member here (perhaps because it's clearest to keep these in 
alphabetic order)
# results in no refactoring
... (30+ more)
green = ()
red = ()

A big advantage of the class based Enums compared to the functional API is that 
you can clearly document an Enum and its members in way Sphinx can take 
advantage of and developers would be used to.


# Assuming tuple assignment version for this example.
class ClientOperationMode(enum.AutoEnum):
"""Modes of operations of the network client."""

push = ()
"""The client pushes data to the server automatically."""

pull = ()
"""The client pulls commands from the server."""

hybrid = ()
"""The client both pushes data and pulls for commands from the server."""

Sphinx will document this AutoEnum like a normal class, pulling in the class 
docstring, and attribute docstrings.

I don't see an obvious way to do this in the functional API docs: 
https://docs.python.org/library/enum.html#functional-api

--

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread Chi Hsuan Yen

Changes by Chi Hsuan Yen :


--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread STINNER Victor

New submission from STINNER Victor:

When reading the issue #27725, I saw that x_sub() of Objects/longobject.c is 
too careful just to change the sign of the newly created number: z cannot be 
shared at the end of the function, before z is normalized.

Attached patch simplifies the code.

See also the issue #27073, another similar simplification.

--
files: x_sub.patch
keywords: patch
messages: 272933
nosy: haypo, mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
status: open
title: longobject.c: simplify x_sub(), inline _PyLong_Negate()
versions: Python 3.6
Added file: http://bugs.python.org/file44132/x_sub.patch

___
Python tracker 

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



[issue27725] Use Py_SIZE(x) instead of x->ob_size

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

I suggest to close this issue.

Aliasing issues are complex and simply cannot be fixed in Python 2. The root 
issue has been fixed in Python 3, it required to change the main C structures 
of Python objects.

The fix for your issue to already known, use -qalias=noansi with XLC.

--
nosy: +haypo

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread Steve Dower

Steve Dower added the comment:

Thanks for the regen. I don't think git format is the problem as most of my 
patches are fine, it's probably because it was in a patch queue and so the 
parent isn't actually a known commit. I haven't tested whether this works 
without my other console patches but I think it should.

Is there a surrogatepass option? If so, I'll definitely use that, as that'll 
fix the one remaining edge case.

I suspect we'll have to go to Guido to get a ruling on the default, but I'll 
add an environment variable to switch.

--

___
Python tracker 

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



[issue27725] Use Py_SIZE(x) instead of x->ob_size

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

I mean that fixing ob->ob_size in Objects/longobject.c is not enough. You 
should also fix C structures and fix all other C files in the code base... It's 
too late for such major refactoring in Python 2.

--

___
Python tracker 

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



[issue12319] [http.client] HTTPConnection.request not support "chunked" Transfer-Encoding to send data

2016-08-17 Thread Martin Panter

Martin Panter added the comment:

Patch 12 has the following changes:

* Change the chunked_encoding parameter to keyword-only
* Drop most of the change regarding the UpdatingFile test (see code review)
* Update the urlopen() TypeError to mention “data” may be a file object
* Fix and update the tests (they weren’t actually being run)
* Various minor documentation corrections, e.g. wrong parameter name.

I think there are a few of my comments to Demian’s patches that are still 
relevant, but they are just opportunities for improving the code (e.g. making 
the chunking iteration more efficient and readable). This version is hopefully 
“good enough”.

--
Added file: http://bugs.python.org/file44133/issue12319_12.patch

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +Oren Milman

___
Python tracker 

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



[issue27785] Module platform: Versions of Windows

2016-08-17 Thread R. David Murray

Changes by R. David Murray :


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

___
Python tracker 

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



[issue27558] SystemError with bare `raise` in threading or multiprocessing

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

I reviewed  issue27558_v2.patch, see my comments.

--

___
Python tracker 

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



[issue27731] Opt-out of MAX_PATH on Windows 10

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Hum, but we use the same binary (.exe) for all Windows versions. Does it mean 
that we drop support for Windows < 10 in Python 3.6?

--
nosy: +haypo

___
Python tracker 

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



[issue27725] Use Py_SIZE(x) instead of x->ob_size

2016-08-17 Thread Stefan Krah

Stefan Krah added the comment:

Agreed, the changes are too big for 2.7.

--
resolution:  -> wont fix
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



[issue27682] wsgiref: Windows Error 10053, ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Windows Error 10053, ConnectionAbortedError: [WinError 10053] An 
established connection was aborted by the software in your host machine -> 
wsgiref: Windows Error 10053, ConnectionAbortedError: [WinError 10053] An 
established connection was aborted by the software in your host machine

___
Python tracker 

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



[issue18880] ssl.SSLSocket shutdown doesn't behave like socket.shutdown

2016-08-17 Thread STINNER Victor

Changes by STINNER Victor :


--
type: behavior -> security

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-17 Thread Emanuel Barry

Emanuel Barry added the comment:

I tend to like all things magic, but the more I think about it, and the less I 
like it being a part of the standard library. I've had a use for this feature 
before, and when I did, I cooked my own 12-lines subclass of EnumMeta and 
_EnumDict. Raymond's points are pretty spot-on, and I also think that this 
shouldn't go in the stdlib. There's still time.

While this particular flavour of magic sounds too, well, magic, for Python or 
even myself, I think a less magical approach can be taken. Namely, something 
like AutoNumberedEnum which requires values to be empty tuples is being 
explicit about what you want and not allowing typos in the class definition. 
Raymond's point about (temporarily) commenting out enum members breaking the 
order highlights this, and while this approach doesn't solve it, it makes it 
obvious that there is *something* that changed.

Another approach, which doesn't exclude the above, is to make EnumMeta and 
_EnumDict public and documented classes (!), thus allowing people like me to 
create their own blueberry-flavoured magic enumerations without any impact on 
the people who don't use my code. Or if I don't feel like reinventing the 
wheel, I can just pip install the module and use that instead.

I think that the whole idea of making enums in Python work like they do in C is 
looking at the problem from the wrong angle. It's true that Python takes some 
of its design from C, but naively trying to replicate C-like behaviour with 
C-like syntax doesn't work all the time. How often do beginners think 'x ^ y' 
means 'x to the power of y', and are then surprised by the behaviour?

I think this version of Enum raises the barrier to entry for new programmers. 
Enum is a nice feature, and it helps new and old programmers alike write 
clean(er) code for various purposes. When a programmer sees this use, they 
won't think "oh this must call __getitem__ and then assign an automatic value", 
they'll wonder "why is this code even running?". And then it's up to the 
Raymonds of this world to explain that Enum uses a metaclass (which, I'm sure, 
is not a topic they'll want to tackle by the time these programmers reach Enum) 
and that the mapping overloads __getitem__.

All in all, this magical approach is just too magical for Python. I understand 
that magic is fun to have and play with, but the standard libary isn't where 
you should keep your toys. I use a throwaway repo for all my magic 
this-is-not-a-good-idea-but-I-wanna-do-it-anyway ideas, and this is where I 
think such magic goes. It definitely doesn't belong in the standard library, 
within an arm's reach of the first curious programmer to wander there.

--
nosy: +ebarry

___
Python tracker 

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



[issue27725] Use Py_SIZE(x) instead of x->ob_size

2016-08-17 Thread REIX Tony

REIX Tony added the comment:

OK.

However, compiling ONLY the file Objects/longobject.c with -qalias=noansi did 
fix the issue on AIX. That could be the same on Linux.

I haven't tried to use Py_SIZE() in all places where it should be used. Now 
trying to figure out why GCC behaves worst than XLC.

Anyway, I have a satisfactory work-around.
Thanks for your help !

--

___
Python tracker 

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



[issue27558] SystemError with bare `raise` in threading or multiprocessing

2016-08-17 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for your review, Victor. :) Leave a reply.

--

___
Python tracker 

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



[issue27725] Use Py_SIZE(x) instead of x->ob_size

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> However, compiling ONLY the file Objects/longobject.c with -qalias=noansi did 
> fix the issue on AIX. That could be the same on Linux.

Nobody asked to only set the compiler file to only this file.

As we said, the issue is sprayed in all the C code base. The whole Python 2 
project has aliasing issues. Extension modules have same the issue.

--

___
Python tracker 

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



[issue27698] socketpair not in socket.__all__ on Windows

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

The issue should now be fixed by my change. Thanks for the bug report!

--
nosy: +haypo
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue27698] socketpair not in socket.__all__ on Windows

2016-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ac2bc921169c by Victor Stinner in branch '3.5':
Issue #27698: Add socketpair to socket.__all__ on Windows
https://hg.python.org/cpython/rev/ac2bc921169c

--
nosy: +python-dev

___
Python tracker 

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



[issue24853] Py_Finalize doesn't clean up PyImport_Inittab

2016-08-17 Thread Xiang Zhang

Xiang Zhang added the comment:

> initialize/run script/finalize will crash the second time

I don't think so since we already get a test case in test_capi that does 
init/fini repeatedly. It does not crash.

So I agree to close this one.

--

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> floor_nroot does arithmetic with integers of bit-length approximately 54*n.

Oh, I see.

But maybe the Decimal is fast enough for such giant numbers, since we
can control the precision?

--

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> Is there a surrogatepass option?

I'm talking about error handlers of Python codecs: text.encode('utf8',
'surrogatepass')

--

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> I suspect we'll have to go to Guido to get a ruling on the default, but I'll 
> add an environment variable to switch.

If you go in this direction, I would like to follow you for the
UNIX/BSD side to make the switch portable. I was thinking about "-X
utf8" which avoids to change the command line parser.

If we agree on a plan, I would like to write it down as a PEP since I
expect a lot of complains and questions which I would prefer to only
answer once (see for example the length of your thread on python-ideas
where each people repeated the same things multiple times ;-))

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> It's not just C that has enums where you can define a unique group of names 
> and omit the values ...

Yes, Python 3.4 too: Animal = Enum('Animal', 'ant bee cat dog')

https://docs.python.org/dev/library/enum.html#functional-api

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> Raymond, what are your thoughts about the version of AutoEnum that requires 
> that a bare tuple be used as the value.  It has been in the Python docs since 
> 3.4 and was actually the original request of this issue: 
> https://docs.python.org/library/enum.html#autonumber

Well, I suggest to keep it as a recipe in the doc ;-)

--

___
Python tracker 

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



[issue24853] Py_Finalize doesn't clean up PyImport_Inittab

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

The issue was fixed by a previous change, maybe the issue #27736.

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

___
Python tracker 

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



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-17 Thread Martin Panter

New submission from Martin Panter:

In Issue 12319, there are many iterations of a patch that adds a new TestCase 
subclass to Lib/test/test_httplib.py. However it never got run by the main 
regrtest infrastructure, because nobody remembered to add the class to the list 
of test classes. So I want to remove test_main(). It seems this would let the 
classes be automatically discovered (like normal unittest usage).

I understand @reap_threads is to avoid background threads continuing between 
tests (especially when a test fails). I improved the cleanup of the background 
thread in one test. There are three other test methods using 
test.ssl_servers.make_https_server(), which also runs a background thread, but 
that already seems to clean itself up properly, via 
case.addCleanup(server.join).

I found that the test infrastructure randomly complained about dangling threads 
without @reap_threads. It uses a set of weak references to thread objects. The 
solution seems to be to call gc.collect() before checking. This is what 
@reap_threads does, so maybe my patch would eliminate the need for 
@reap_threads in other test files as well. In fact, if everybody called join() 
on their threads, we may be able to eliminate @reap_threads altogether.

--
components: Tests
files: httplib-tests.patch
keywords: patch
messages: 272954
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Avoid test_main() in test_httplib; gc.collect() dangling threads
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file44134/httplib-tests.patch

___
Python tracker 

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



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Your patch changes 3 different things. After the code review, I suggest to 
split it in two changes (fix test_httplib threading ripper, fix save_env, fix 
test_httplib main).

--
nosy: +haypo

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-08-17 Thread Ethan Furman

Ethan Furman added the comment:

The repr is better -- which patch did you test?

--

___
Python tracker 

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



[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-17 Thread Petr Viktorin

Petr Viktorin added the comment:

Hi! I'm on a tight schedule this week, so I'm not looking into this in detail. 
But please let me know if you need any help and I'll raise the priority.

--

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> The repr is better -- which patch did you test?

Sorry, I wasn't clear. I didn't test any patch :-) I expect (not
expected) better repr when changes will be applied, it's just a
remark...

--

___
Python tracker 

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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on Linux

2016-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 385181e809bc by Vinay Sajip in branch 'default':
Closes #9998: Allowed find_library to search additional locations for libraries.
https://hg.python.org/cpython/rev/385181e809bc

--
nosy: +python-dev
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



[issue27731] Opt-out of MAX_PATH on Windows 10

2016-08-17 Thread Steve Dower

Steve Dower added the comment:

No, the flag that we add to the binary is backwards compatible. Earlier 
versions will just ignore it.

--

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread Steve Dower

Steve Dower added the comment:

By portable, do you mean not using an environment variable?

Command line parsing is potentially affected by this on Windows - I'd have to 
look deeper - as command lines are provided as UTF-16. But we may not ever 
expose them as bytes.

I don't even know that this matters on the UNIX/BSD side as the file system 
encoding provided there is correct, no? It's just Windows where the file system 
encoding used for bytes doesn't match what the file system actually uses.

I was afraid a PEP would be necessary out of this, but I want to see how the 
python-dev discussion goes first.

--

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Steve Dower added the comment:
> By portable, do you mean not using an environment variable?

I mean that "python3 -X utf8" should force sys.getfilesystemencoding()
to UTF-8 on UNIX/BSD, it would ignore the current locale setting.

--

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread Steve Dower

Steve Dower added the comment:

Ah I see, if we end up sticking with MBCS and offering a switch to enable 
UTF-8. In that case, we'll definitely ensure the flag is the same (but I'm 
hopeful we will just make the reliable behavior on Windows the default, so it 
won't matter).

--

___
Python tracker 

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



[issue27788] platform module's version number doesn't match its docstring

2016-08-17 Thread Brett Cannon

New submission from Brett Cannon:

Not sure if it's worth keeping the version number around, but ATM the module 
has __version__ set to 1.0.7 while the docstring mentions a 1.0.8.

--
components: Library (Lib)
messages: 272964
nosy: brett.cannon, lemburg
priority: normal
severity: normal
status: open
title: platform module's version number doesn't match its docstring
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



[issue27785] Module platform: Versions of Windows

2016-08-17 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue27785] Module platform: Versions of Windows

2016-08-17 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue27781] Change sys.getfilesystemencoding() on Windows to UTF-8

2016-08-17 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread Brett Cannon

Brett Cannon added the comment:

I would add a comment as to why the assertion is there, otherwise it seems 
somewhat random that it exists.

--
nosy: +brett.cannon

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

> I would add a comment as to why the assertion is there, otherwise it seems 
> somewhat random that it exists.

Hum. Maybe it's even better to remove the assertion :-)

--

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread Brett Cannon

Brett Cannon added the comment:

That works too. :)

--

___
Python tracker 

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



[issue27785] Module platform: Versions of Windows

2016-08-17 Thread Steve Dower

Steve Dower added the comment:

Platform module version 1.0.8 added support for Windows 8.1 and later. You 
actually downgraded to 1.0.7, which is why you lost functionality.

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

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Updated patch.

--
Added file: http://bugs.python.org/file44135/x_sub-2.patch

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-17 Thread Mark Dickinson

Mark Dickinson added the comment:

> self.assertEqual(self.nroot(x**12, 12), float(x))
> AssertionError: 1.1865 != 1.1868

That looks like a case where the test should simply be weakened to an 
`assertAlmostEqual` with a suitable tolerance; there's no strong reason to 
expect that `nroot` will give a faithfully rounded result in this case or any 
other.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-17 Thread Ethan Furman

Ethan Furman added the comment:

Raymond, I appreciate your review and your poll.  I am open to removing 
AutoEnum, but would like to give it a couple more weeks of review.  (I'll post 
on py-dev.)

The only point you made that I will firmly refute is the "unexpected breakage": 
you ran your test script with the -m "run module as script" flag, which is what 
caused the problem.

--

___
Python tracker 

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



[issue27706] Random.seed, whose purpose is purportedly determinism, behaves non-deterministically with strings due to hash randomization

2016-08-17 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

It does seem to be stable on python 3, but on python 2.7 it's definitely a 
problem:

$ python -Rc "import random; r=random.Random('abc'); print(''.join(map(str, 
(r.randrange(10) for x in range(10, hash('abc'))"
('9553343809', -1972659830997666042)
$ python -Rc "import random; r=random.Random('abc'); print(''.join(map(str, 
(r.randrange(10) for x in range(10, hash('abc'))"
('5519010739', 5520208254012363023)
$ python -Rc "import random; r=random.Random('abc'); print(''.join(map(str, 
(r.randrange(10) for x in range(10, hash('abc'))"
('7519888435', 3560222494758569319)
$ python -Rc "import random; r=random.Random('abc'); print(''.join(map(str, 
(r.randrange(10) for x in range(10, hash('abc'))"
('9612648103', 4134882069837806740)

--

___
Python tracker 

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



[issue27706] Random.seed, whose purpose is purportedly determinism, behaves non-deterministically with strings due to hash randomization

2016-08-17 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

Changing the affected version to just 2.7.

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



[issue27755] Retire DynOptionMenu with a ttk Combobox

2016-08-17 Thread Mark Roseman

Mark Roseman added the comment:

Justin, as you say, I think your patch is entirely reasonable as an interim 
step, as eventually doing a broader improvement on the preferences dialog as 
suggested in #24781 makes sense. 

My reworked version used Combobox in similar ways; I think we can safely do 
away with the wrapper class and just use the ttk widget directly in the dialog 
(as the widget already handles the dynamic changes to the list, which the old 
tk_optionMenu didn't)

--

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

Maybe use size_a instead of Py_SIZE(z)?

And look at "sign". Currently it takes values 1 and -1. Is it worth to replace 
it with boolean variable "negative"? Or Py_ssize_t variable size_z that takes 
values size_a and -size_a?

--

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset be9dc240bf28 by Victor Stinner in branch 'default':
Issue #27786: Simplify x_sub()
https://hg.python.org/cpython/rev/be9dc240bf28

--
nosy: +python-dev

___
Python tracker 

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



[issue27782] Multi-phase extension module initialization, inconsistent exceptions and conflicts between code and PEP

2016-08-17 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks Petr. I'd appreciate it if you are willing to review the patch.

Upload a patch to fix this, along with tests and doc updating.

But here is something different. In PEP489, it is explicitly stated that 
"Py_mod_create slot is not responsible for setting import-related attributes 
specified in PEP 451 (such as __name__ or __loader__ ) on the new module". So 
when an object(even ModuleType instances) is returned, it's __name__ attribute 
is not set and we can't rely on it (which means we can't even use 
PyModule_GetNameObject). I then use the name attribute of the spec. Looking 
forward to feedback.

--
keywords: +patch
Added file: http://bugs.python.org/file44136/issue27782.patch

___
Python tracker 

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



[issue27786] longobject.c: simplify x_sub(), inline _PyLong_Negate()

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Thanks for the review Brett, I pushed my fix.

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

___
Python tracker 

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



[issue27574] Faster parsing keyword arguments

2016-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I left this issue open for three reasons.

1. I had ideas and almost finished patch for different optimization. 
Unfortunately my hope was not justified, new implementation is slower. If I 
fail to fix it in few days, I'll close the issue.

2. For bikeshedding in case somebody want to suggest different names or 
interface.

3. I was going to convert most occurrences of PyArg_ParseTupleAndKeywords() to 
Argument Clinic for achieving larger effect of this optimization. But this 
patch was larger than I expected.

--

___
Python tracker 

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



[issue26200] SETREF adds unnecessary work in some cases

2016-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Raymond and Victor.

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



[issue27574] Faster parsing keyword arguments

2016-08-17 Thread Brett Cannon

Brett Cannon added the comment:

I think for converting uses to Argument Clinic it can be done in a more 
iterative process on a per-module basis. How many modules do we have left to 
convert? If it isn't ridiculously huge we could open individual issues to 
convert them each.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> you ran your test script with the -m "run module as script" flag

Right, that was a mistest, so it looks like triple quotes do work.

I did notice that there's also an issue if one line reads, "red='hello'".

But really, the big issue is using a bare-identifier to fiat an attribute into 
existence.  That's a door that really shouldn't be opened.

Secondarily, the doesn't seem to be any use case that can't be readily covered 
by the existing classes.  There is no real need for the witchcraft and the 
departure from Python norms.

--

___
Python tracker 

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



[issue18880] ssl.SSLSocket shutdown doesn't behave like socket.shutdown

2016-08-17 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +alex, dstufft, giampaolo.rodola, janssen
versions: +Python 3.6 -Python 2.6, Python 3.1

___
Python tracker 

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



[issue27574] Faster parsing keyword arguments

2016-08-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, I came to conclusion than needed to push existing issues for separate 
files. I'm sure there are ready patches waiting for review. Now there is 
additional reason for converting to Argument Clinic. But some files contain 
only one PyArg_ParseTupleAndKeywords(), I think we can convert them in one 
patch.

--

___
Python tracker 

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



[issue27645] Supporting native backup facility of SQLite

2016-08-17 Thread Cédric Krier

Changes by Cédric Krier :


--
nosy: +ced

___
Python tracker 

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



  1   2   >