[issue29767] build python failed on test_socket due to unused_port is actually used.

2017-03-08 Thread Xiang Zhang

Xiang Zhang added the comment:

Could you show the failure message here? And you could make your patch a PR on 
GitHub.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29764] PyUnicode_Decode with encoding utf8 crashes

2017-03-08 Thread Xiang Zhang

Xiang Zhang added the comment:

You need to first call `Py_Initialize()` to initialize the Python interpreter. 
It is required.

--
nosy: +xiang.zhang
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue20087] Mismatch between glibc and X11 locale.alias

2017-03-08 Thread Benjamin Peterson

Benjamin Peterson added the comment:

"eo_XX" is just something that appears in the X11 locale.alias file. My change 
doesn't add that; it was already there. (for Esperanto, which I suppose 
explains the "XX")

Most of the changes you identify the glibc aliases taking precedence over the 
X11 ones. e.g., glibc has "fi_FI ISO-8859-1" while the X11 locale list has 
"fi_FI.ISO8859-15". That seems correct to me as far as the intent of this 
change is concerned.

How do you propose to pick and choose what we use from the X11 locale alias 
list?

--

___
Python tracker 

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



[issue29759] Deadlock in multiprocessing.pool.Pool on terminate

2017-03-08 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +davin
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan

Changes by Nick Coghlan :


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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, https://github.com/python/cpython/pull/575 is the new PR that covers 
everything needed to fix the root cause of the problem (which was the entirely 
unnecessary add-and-overwrite dance that zipfile and directory executation was 
doing for sys.path[0])

--

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +471

___
Python tracker 

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



[issue29319] Embedded 3.6.0 distribution cannot run pyz files

2017-03-08 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +472

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Slightly correction, as I didn't have the isolated mode equivalents quite 
correct:

python3 -s script_dir/__main__.py
python3 -s script_dir
python3 -I script_dir

Isolated mode still runs the system site.py, which turns out to be signficant 
in a development checkout (getpath includes the Lib/ directory twice, and 
site.py then cleans out the duplicate).

So I think this PR is the right fix, but need confirmation from Steve that it 
still solves the original problem reported in issue 29319.

(Note the current PR is open against the 3.6 branch - I'm going to make a new 
single-commit one against master, flagging it for cherry-picking, then close 
this one)

--
assignee:  -> steve.dower
stage: needs patch -> commit review

___
Python tracker 

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



[issue29760] tarfile chokes on reading .tar file with no entries (but does fine if the same file is bzip2'ed)

2017-03-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +lars.gustaebel
type: crash -> behavior
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue29762] Use "raise from None"

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't think this is needed. The traceback points to the actual line -- the 
line with the "raise" statement.

--

___
Python tracker 

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



[issue29768] Fix expact version check

2017-03-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +470

___
Python tracker 

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



[issue29768] Fix expact version check

2017-03-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The compile-time check for expat version added in issue14234 doesn't work with 
expat 3.0.0. Following PR fixes this.

--
components: Extension Modules, XML
messages: 289273
nosy: gregory.p.smith, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Fix expact version check
type: security
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29682] Possible missing NULL check in pyexpat

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Alex and svelankar for your report and fix.

--
resolution:  -> fixed
stage: needs patch -> 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



[issue29682] Possible missing NULL check in pyexpat

2017-03-08 Thread svelankar

Changes by svelankar :


--
pull_requests: +469

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Work in progress PR at https://github.com/python/cpython/pull/571

I also came up with a reasonably straightforward way of defining the desired 
"sys.path" initialisation behaviour, which is that the following should all get 
the *same* sys.path entries:

python3 -S script_dir/__main__.py
python3 -S script_dir
python3 -I script_dir

None of those should have the current directory on sys.path, but they should 
*all* have `script_dir` as the first entry on sys.path (and it will be absolute 
by the time user code runs, even though RunMainAsImporter itself doesn't yet 
ensure that).

They all differ from the `python3 -m script_dir` and `python3 -m 
script_dir.__main__` cases, as those are the exact opposite: they *should* have 
the current directory as the first entry on sys.path and *should not* have 
`script_dir` in sys.path at all.

--

___
Python tracker 

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



[issue29756] Improve documentation for list methods that compare items by equality

2017-03-08 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +468

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +467

___
Python tracker 

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



[issue29756] Improve documentation for list methods that compare items by equality

2017-03-08 Thread Xiang Zhang

Xiang Zhang added the comment:

+1 for jsoh. Actually the behaviour is documented in 
https://docs.python.org/3/reference/expressions.html#value-comparisons.

So a single 'a is b' or 'a == b' is not complete. I would like to use 'equal 
to' which implies 'a is b or a == b'.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Nick Coghlan

Nick Coghlan added the comment:

As Eryk notes, this has revealed a separate bug in that we don't make the path 
absolute when adding to sys.path. However, that's *not* directly related to the 
regression, so I'm resisting the temptation to change it here.

Instead, the new test case I'm adding will just run a script directory both 
with and without -I, and make sure sys.path ends up the same in both cases.

--

___
Python tracker 

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



[issue29767] build python failed on test_socket due to unused_port is actually used.

2017-03-08 Thread Shuo Li

New submission from Shuo Li:

I am running a debian system. And trying to build cpython3.6 from source. 
When I run make altinstall, it failed on test_socket. Reporting cli attribute 
is missing.

After some trouble shooting, it seems the support.get_unused_port() is not 
reliable. Then I modified it and return a port I am sure no one is using, the 
build succeeded.

--
components: Build
messages: 289268
nosy: Shuo Li
priority: normal
severity: normal
status: open
title: build python failed on test_socket due to unused_port is actually used.
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



[issue29762] Use "raise from None"

2017-03-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Particularly when the type of the exception isn't being changed, it's only 
altering the message to provide more information?

--

___
Python tracker 

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



[issue29762] Use "raise from None"

2017-03-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

To tie the exceptions to the actual line, would it perhaps make sense to copy 
over the traceback of the original exception using .with_traceback?

--
nosy: +josh.r

___
Python tracker 

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



[issue29758] Previously-working SWIG code fails in Python 3.6

2017-03-08 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +haypo, serhiy.storchaka

___
Python tracker 

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



[issue29760] tarfile chokes on reading .tar file with no entries (but does fine if the same file is bzip2'ed)

2017-03-08 Thread Matt Bogosian

Matt Bogosian added the comment:

FWIW, the (offending) fix for #24259 was introduced (e.g., in 2.7) via 2.7.10. 
I've verified that 2.7.9 works as expected:

```
$ python -V
Python 2.7.9
$ python tarfail.py
opening /…/tarfail/test.tar.bz2
opening /…/tarfail/test.tar
.
--
Ran 1 test in 0.010s

OK
```

So this should probably be considered a regression.

--

___
Python tracker 

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



[issue10408] Denser dicts and linear probing

2017-03-08 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Agreed.  This doesn't make sense for the compact dict implementation.

--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue29766] --with-lto still implied by --enable-optimizations in Python 2.7

2017-03-08 Thread Hanno Schlichting

New submission from Hanno Schlichting:

I think the fix for issue28032 wasn't applied correctly to the 2.7 branch.

Compare the change in Python 2.7:

https://github.com/python/cpython/commit/9cbfa79111e7152231556a21af90a220b72ed086#diff-e2d5a00791bce9a01f99bc6fd613a39dL6425

vs. for example Python 3.5:

https://github.com/python/cpython/commit/14c7f71150c94ca35ca913b15c3d0cd236691ed6#diff-e2d5a00791bce9a01f99bc6fd613a39dL6567

In Python 3.5 the Py_LTO='true' line was before the Darwin block and got 
removed. In Python 2.7 the line was after the block and was left in place.

I'm guessing this was a simply mistake, while backporting the change.

--
components: Build
messages: 289263
nosy: Hanno Schlichting, gregory.p.smith
priority: normal
severity: normal
status: open
title: --with-lto still implied by --enable-optimizations in Python 2.7
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



[issue29765] 2.7.12 compile error from ssl related

2017-03-08 Thread ada

New submission from ada:

Download the python version 2.7.12 source code from official web site.
Compile the python code by the following steps:
sudo ./configure
sudo make
sudo make install

but from make, I get the following errors:
/Modules/_ssl.c: In function ‘_create_tuple_for_X509_NAME’:
./Modules/_ssl.c:684: error: dereferencing pointer to incomplete type
./Modules/_ssl.c:701: error: dereferencing pointer to incomplete type
./Modules/_ssl.c: In function ‘_get_peer_alt_names’:
./Modules/_ssl.c:804: error: dereferencing pointer to incomplete type
./Modules/_ssl.c:809: error: dereferencing pointer to incomplete type
./Modules/_ssl.c:815: error: dereferencing pointer to incomplete type
./Modules/_ssl.c:876: warning: ‘ASN1_STRING_data’ is deprecated (declared at 
/usr/local/include/openssl/asn1.h:553)
./Modules/_ssl.c: In function ‘_get_crl_dp’:
./Modules/_ssl.c:1029: error: dereferencing pointer to incomplete type
./Modules/_ssl.c: In function ‘PySSL_compression’:
./Modules/_ssl.c:1446: error: dereferencing pointer to incomplete type
./Modules/_ssl.c:1448: error: dereferencing pointer to incomplete type
./Modules/_ssl.c: In function ‘context_new’:
./Modules/_ssl.c:2000: warning: ‘TLSv1_method’ is deprecated (declared at 
/usr/local/include/openssl/ssl.h:1596)
./Modules/_ssl.c:2003: warning: ‘TLSv1_1_method’ is deprecated (declared at 
/usr/local/include/openssl/ssl.h:1602)

please help me check where I take a mistake. The related information is:
Linux version: 
Linux root:2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 
x86_64 x86_64 GNU/Linux
OpenSSL version: 
[root@root Python-2.7.12]# rpm -aq | grep openssl
openssl-static-1.0.1e-48.el6_8.4.x86_64
openssl-1.0.1e-48.el6_8.4.x86_64
openssl-devel-1.0.1e-48.el6_8.4.x86_64
COMPILER version: 
[root@root Python-2.7.12]# yum list installed | grep -i  gcc
gcc.x86_64   4.4.7-17.el6   
gcc-c++.x86_64   4.4.7-17.el6   
gcc-gfortran.x86_64  4.4.7-17.el6   
libgcc.i686  4.4.7-17.el6   
libgcc.x86_644.4.7-17.el6   


Thanks in advance.

--
assignee: christian.heimes
components: SSL
messages: 289262
nosy: ada, christian.heimes
priority: normal
severity: normal
status: open
title: 2.7.12 compile error from ssl related
type: compile error
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



[issue29764] PyUnicode_Decode with encoding utf8 crashes

2017-03-08 Thread Alexey Trenikhin

New submission from Alexey Trenikhin:

#include 
int main(){
PyUnicode_Decode("abcdef", 4, "utf_8", "ignore");

  return 0;
}
crashes on linux and Windows (but works fine with encoding "utf-8" )

--
components: Unicode
files: test.c
messages: 289261
nosy: Alexey Trenikhin, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: PyUnicode_Decode with encoding utf8 crashes
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file46713/test.c

___
Python tracker 

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



[issue29749] Outdated int() docstring

2017-03-08 Thread Brett Cannon

Changes by Brett Cannon :


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



[issue29759] Deadlock in multiprocessing.pool.Pool on terminate

2017-03-08 Thread Michael

Changes by Michael :


--
type:  -> behavior
versions: +Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue28298] can't set big int-like objects to items in array 'Q', 'L' and 'I'

2017-03-08 Thread Oren Milman

Changes by Oren Milman :


--
pull_requests: +466

___
Python tracker 

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



[issue29763] test_site failing on AppVeyor

2017-03-08 Thread Brett Cannon

New submission from Brett Cannon:

E.g. https://ci.appveyor.com/project/python/cpython/build/3.7.0a0.142. This 
looks to be the last consistent failure on AppVeyor.

--
components: Windows
messages: 289260
nosy: brett.cannon, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: test_site failing on AppVeyor
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



[issue29761] Wrong size of c_ulong in linux, windows version is fine

2017-03-08 Thread Eryk Sun

Eryk Sun added the comment:

ctypes is correct. 64-bit Linux uses an LP64 data model, and 64-bit Windows 
uses LLP64.

https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models

--
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue29762] Use "raise from None"

2017-03-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +465

___
Python tracker 

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



[issue29762] Use "raise from None"

2017-03-08 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Sometimes after catching some exception the new exception of more appropriate 
type and with more appropriate message is raised. The initial exception often 
is not relevant to the final exception, it is raised only due to using EAFP 
rather than LBYL. It should be excluded from the traceback by using "raise from 
None". This idiom is often used. Following PR makes it be used in more cases.

--
components: Library (Lib)
messages: 289258
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Use "raise from None"
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29761] Wrong size of c_ulong in linux, windows version is fine

2017-03-08 Thread Jorge Cisneros

New submission from Jorge Cisneros:

In the linux version 2.7.12 the size of c_ulong and c_ulonglong is the same, 
that is not correct 

Python 2.7.12 (default, Mar  6 2017, 18:06:04)
[GCC 4.9.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> print sizeof(c_ulong),sizeof(c_ulonglong)
8 8


Doing the same in Windows, the results are correct.

Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> print sizeof(c_ulong),sizeof(c_ulonglong)
4 8
>>>

--
components: ctypes
messages: 289257
nosy: Jorge Cisneros
priority: normal
severity: normal
status: open
title: Wrong size of c_ulong in linux, windows version is fine
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



[issue28810] Document bytecode changes in 3.6

2017-03-08 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

It looks like there are still few things that are not covered in two open PRs. 
I will add these in an additional PR in the next few days.

--

___
Python tracker 

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



[issue29749] Outdated int() docstring

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

After converting int.__new__() to Argument Clinic this issue will become 
outdated.

--

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Eryk Sun

Eryk Sun added the comment:

main361 can be run as a package from the current directory via -m because an 
empty string is in sys.path, i.e. the current directory. It imports the 
package, executing __init__.py and then __main__.py. In this case, the main361 
directory/zip import source is not added to sys.path.

When we run main361 as a script, the main361 package is not imported, i.e. 
__init__.py is not executed. The siblings of the __main__.py script are in the 
main361 directory (or zip file). Effectively this is the script directory, and 
it does belong in sys.path -- even in isolated mode because we trust the 
directory or zip file that contains __main__.py. 

A potential problem, however, is that we don't ensure the __main__ import 
source is added as an absolute path. So if the script changes the working 
directory, then it loses this import source and possibly (unlikely) gains a new 
import source if the relative path exists relative to the new working directory.

--

___
Python tracker 

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



[issue29760] tarfile chokes on reading .tar file with no entries (but does fine if the same file is bzip2'ed)

2017-03-08 Thread Matt Bogosian

New submission from Matt Bogosian:

It looks like there's a problem examining ``.tar`` files with no entries:

```
$ # ==
$ # Extract test cases (attached to this bug report)
$ tar xpvf tarfail.tar.bz2
x tarfail/
x tarfail/tarfail.py
x tarfail/test.tar
x tarfail/test.tar.bz2
$ cd tarfail
$ # ==
$ # Note that test.tar.bz2 is just test.tar, but bzip2'ed:
$ bzip2 -c test.tar | openssl dgst -sha256 ; openssl dgst -sha256 test.tar.bz2
f4fad25a0e7a451ed906b76846efd6d2699a65b40795b29553addc35bf9a75c8
SHA256(test.tar.bz2)= 
f4fad25a0e7a451ed906b76846efd6d2699a65b40795b29553addc35bf9a75c8
$ wc -c test.tar*  # these are not empty files
   10240 test.tar
  46 test.tar.bz2
   10286 total
$ tar tpvf test.tar  # no entries
$ tar tpvf test.tar.bz2  # no entries
$ # ==
$ # test.tar.bz2 works, but test.tar causes problems (tested in 2.7,
$ # 3.5, and 3.6):
$ python2.7 tarfail.py
opening /…/tarfail/test.tar.bz2
opening /…/tarfail/test.tar
E
==
ERROR: test_next (__main__.TestTarFileNext)
--
Traceback (most recent call last):
  File "tarfail.py", line 29, in test_next
next_info = tar_file.next()
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", 
line 2350, in next
self.fileobj.seek(self.offset - 1)
IOError: [Errno 22] Invalid argument

--
Ran 1 test in 0.005s

FAILED (errors=1)
$ python3.5 tarfail.py
opening /…/tarfail/test.tar.bz2
opening /…/tarfail/test.tar
E
==
ERROR: test_next (__main__.TestTarFileNext)
--
Traceback (most recent call last):
  File "tarfail.py", line 29, in test_next
next_info = tar_file.next()
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tarfile.py", 
line 2273, in next
self.fileobj.seek(self.offset - 1)
OSError: [Errno 22] Invalid argument

--
Ran 1 test in 0.066s

FAILED (errors=1)
$ python3.6 tarfail.py
opening /…/tarfail/test.tar.bz2
opening /…/tarfail/test.tar
E
==
ERROR: test_next (__main__.TestTarFileNext)
--
Traceback (most recent call last):
  File "tarfail.py", line 29, in test_next
next_info = tar_file.next()
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tarfile.py", 
line 2279, in next
self.fileobj.seek(self.offset - 1)
OSError: [Errno 22] Invalid argument

--
Ran 1 test in 0.090s

FAILED (errors=1)
```

Here's the issue (as far as I can tell):

```
$ ipdb tarfail.py
> /…/tarfail/tarfail.py(3)()
  2
> 3 from __future__ import (
  4 absolute_import, division, print_function, unicode_literals,

ipdb> b 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py:2350
Breakpoint 1 at 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py:2350
ipdb> c
opening /…/tarfail/test.tar.bz2
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py(2350)next()
   2349 if self.offset != self.fileobj.tell():
1> 2350 self.fileobj.seek(self.offset - 1)
   2351 if not self.fileobj.read(1):

ipdb> self.fileobj

ipdb> self.offset, self.fileobj.tell(), self.offset - 1
(0, 512, -1)
ipdb> c
opening /…/tarfail/test.tar
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py(2350)next()
   2349 if self.offset != self.fileobj.tell():
1> 2350 self.fileobj.seek(self.offset - 1)
   2351 if not self.fileobj.read(1):

ipdb> self.fileobj

ipdb> self.offset, self.fileobj.tell(), self.offset - 1
(0, 512, -1)
ipdb> c
E
==
ERROR: test_next (__main__.TestTarFileNext)
--
Traceback (most recent call last):
  File "tarfail.py", line 29, in test_next
next_info = tar_file.next()
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", 
line 2350, in next
self.fileobj.seek(self.offset - 1)
IOError: [Errno 22] Invalid argument

--
Ran 1 test in 38.300s

FAILED (errors=1)
The program exited via sys.exit(). Exit status: True
> /…/tarfail/tarfail.py(3)()
  2
> 3 from __future__ import (
  4 absolute_import, division, 

[issue29749] Outdated int() docstring

2017-03-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue29749] Outdated int() docstring

2017-03-08 Thread svelankar

svelankar added the comment:

True, but the docstring says "return 0 if no arguments are given". So please 
let me know, if you want me to still change it i.e. add int() or keep it as it 
is. Thanks.

--

___
Python tracker 

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



[issue29749] Outdated int() docstring

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

int() can be called without argument.

--

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2017-03-08 Thread Brett Cannon

Brett Cannon added the comment:

If the "ping" is for me, I spent my open source day last week reviewing the 
dependency for this issue (and other stuff) so I plan to get to this PR this 
Friday.

--

___
Python tracker 

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



[issue29759] Deadlock in multiprocessing.pool.Pool on terminate

2017-03-08 Thread Michael

Michael added the comment:

This patch kind of solves the issue. Not a nice one, but perhaps the safest one.

https://github.com/michael-a-cliqz/cpython/commit/1536c8c8cfc5a87ad4ab84d1248cb50fefe166ae

--

___
Python tracker 

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



[issue29749] Outdated int() docstring

2017-03-08 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +464

___
Python tracker 

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



[issue29759] Deadlock in multiprocessing.pool.Pool on terminate

2017-03-08 Thread Michael

New submission from Michael:

Following code snippet causes a deadlock on Linux:

"""
import multiprocessing.pool
import signal


def signal_handler(signum, frame):
pass

if __name__ == '__main__':
signal.signal(signal.SIGTERM, signal_handler)
pool = multiprocessing.pool.Pool(processes=1)
pool.terminate() # alternatively - raise Exception("EXCEPTION")
"""

The reason is that the termination code starts before the worker processes 
being fully initialized.

Here, parent process acquires a forever-lock:

"""
@staticmethod
def _help_stuff_finish(inqueue, task_handler, size):
# task_handler may be blocked trying to put items on inqueue
util.debug('removing tasks from inqueue until task handler finished')
inqueue._rlock.acquire()  < -
while task_handler.is_alive() and inqueue._reader.poll():
inqueue._reader.recv()
time.sleep(0)
"""

And then the worker processes are getting stuck here:

"""
def worker(...):

while maxtasks is None or (maxtasks and completed < maxtasks):
try:
task = get()  < - trying to acquire 
the same lock
except (EOFError, OSError):
util.debug('worker got EOFError or OSError -- exiting')
break


"""

Whats going on then? As far as the default process start method is set to 
'fork', worker subprocesses inherit parent's signal handler. Trying to 
terminate workers from _terminate_pool() doesn't have any effect. Finally, 
processes enter into a deadlock when parent join()-s workers.

--
components: Library (Lib)
messages: 289248
nosy: mapozyan
priority: normal
severity: normal
status: open
title: Deadlock in multiprocessing.pool.Pool on terminate
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



[issue28810] Document bytecode changes in 3.6

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--

___
Python tracker 

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



[issue29749] Outdated int() docstring

2017-03-08 Thread svelankar

svelankar added the comment:

int docstring is the only one that needs to be changed. docstrings for 
float,tuple and list look fine to me.

--
nosy: +svelankar

___
Python tracker 

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



[issue26259] Memleak when repeated calls to asyncio.queue.Queue.get is performed, without push to queue.

2017-03-08 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue29758] Previously-working SWIG code fails in Python 3.6

2017-03-08 Thread Tristan Croll

New submission from Tristan Croll:

Possibly related to http://bugs.python.org/issue29327 - yields the same error 
message:

Objects/tupleobject.c:81: bad argument to internal function

I have a large SWIG project which was previously working well in Python 3.5. 
After migrating to Python 3.6.0, I find I can still create any wrapped object 
from Python via its constructor(s), but any internal function that returns 
certain objects fails with the above message. I have so far been unable to find 
any distinction between classes that do and don't return successfully. Take the 
below (and attached) headers, for example. Functions that return Spacegroup 
objects work, as do those that return Metric_tensor objects from the attached 
cell.h. On the other hand, functions returning Cell or Cell_descr objects fail 
with the above message. Yet in all cases I can successfully call the objects' 
constructors. Not ashamed to say I'm a bit lost here.


#ifndef CLIPPER_SPACEGROUP
#define CLIPPER_SPACEGROUP


#include "symop.h"
#include "spacegroup_data.h"


namespace clipper {

  // forward definitions
  class HKL;
  class HKL_class;
  class Coord_frac;


  //! spacegroup description
  /*! The spacegroup description is a compact description of a
spacegroup. It may be initialised from Hall or H-M symbols, a
string of symops or a number. Internally a hash code is used to
refer to the spacegroup, so this object is only 32 bits in
size.

For more details of spacegroup symbols, see Sydney R. Hall & Ralf
W. Grosse-Kunstleve 'Concise Space-Group Symbols',
http://www.kristall.ethz.ch/LFK/software/sginfo/hall_symbols.html
  */
  class Spgr_descr
  {
  public:
enum TYPE { Hall, HM, XHM, Symops, Number, Unknown };
//! null constructor
Spgr_descr();
//! constructor: from symbol or operators.
explicit Spgr_descr( const String& symb, TYPE type = Unknown );
//! constructor: from number.
explicit Spgr_descr( const int& num );
//! return the spacegroup number
int spacegroup_number() const;
//! return the Hall symbol
String symbol_hall() const;
//! return the H-M symbol
String symbol_hm() const;
//! return the extended H-M symbol
String symbol_xhm() const;
//! return the extension H-M symbol
String symbol_hm_ext() const;
//! set preferred default spacegroup choice
static void set_preferred( const char& c );

//! Vector of symop codes and associated methods
class Symop_codes : public std::vector
{
public:
  //! initialise from Hall symbol
  void init_hall( const String& symb );
  //! initialise from symops
  void init_symops( const String& symb );
  //! expand (incomplete) list of symops
  Symop_codes expand() const;
  //! return primitive non-inversion ops (by computation)
  Symop_codes primitive_noninversion_ops() const;
  //! return inversion ops (by computation)
  Symop_codes inversion_ops() const;
  //! return primitive incl inversion ops (by computation)
  Symop_codes primitive_ops() const;
  //! return lattice centering ops (by computation)
  Symop_codes centering_ops() const;
  //! return Laue ops
  Symop_codes laue_ops() const;
  //! return point group ops
  Symop_codes pgrp_ops() const;
  //! return Patterson ops
  Symop_codes patterson_ops() const;
  //! return minimal list of generator ops
  Symop_codes generator_ops() const;
  //! return product of this (expanded) list by another (expanded) list
  Symop_codes product( const Symop_codes& ops2 ) const;
  //! return hash code of symop list
  unsigned int hash() const;
};

//! constructor: from symop list.
explicit Spgr_descr( const Symop_codes& ops );
//! return the generators for the spacegroup
const Symop_codes& generator_ops() const { return generators_; }
//! return the hash code for the spacegroup \internal
const unsigned int& hash() const { return hash_; }

  protected:
unsigned int hash_;   //!< hash code of spacegroup
Symop_codes generators_;  //!< codes for symop generators

static char pref_12, pref_hr;  //!< preferred origin and hex/romb symbols
  };


  // ObjectCache data type
  class Spgr_cacheobj
  {
  public:
typedef Spgr_descr Key;
Spgr_cacheobj( const Key& spgr_cachekey );  //!< construct entry
bool matches( const Key& spgr_cachekey ) const; //!< compare entry
String format() const;  //!< string description
// data
Key spgr_cachekey_; //!< spacegroup cachekey
int nsym, nsymn, nsymi, nsymc, nsymp;  //!< number of syms: total, primitive
int lgrp;   //!< Laue group number
std::vector  symops; //!< symmetry operators
std::vector isymops;//!< symmetry operators
Vec3<> asu_min_, asu_max_;  //!< real space ASU
static Mutex mutex; //!< thread safety
  };


  //! Spacegroup object
 

[issue26259] Memleak when repeated calls to asyncio.queue.Queue.get is performed, without push to queue.

2017-03-08 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



[issue26259] Memleak when repeated calls to asyncio.queue.Queue.get is performed, without push to queue.

2017-03-08 Thread Bartek Biernacki

Bartek Biernacki added the comment:

I ran into similar problem with many getters timing out and staying in memory 
until some put is called. 

I think this may be solved by using a callback on Future which would clean it 
if it was cancelled. I am presenting the idea on attached poc.

If you think that this is a good idea I can provide a patch.

--
nosy: +Bartek Biernacki
Added file: http://bugs.python.org/file46710/poc.py

___
Python tracker 

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



[issue28682] Bytes support in os.fwalk()

2017-03-08 Thread Serhiy Storchaka

Changes 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



[issue29756] Improve documentation for list methods that compare items by equality

2017-03-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Steven: Technically, in CPython, they use both identity and equality testing, 
as a function of using RichCompareBool (which tests identity first, then 
equality), rather than RichCompare (which only tests equality).

It makes a difference for stuff like NaN values, where describing it as 
equality only would imply that:

nan = float('nan')
([nan] * 10).count(nan)

produces 0 (because nan is equal to nothing, including itself), when in fact it 
produces 10 (because we reused the same nan object, and the identity test 
passed).

--
nosy: +josh.r

___
Python tracker 

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



[issue20087] Mismatch between glibc and X11 locale.alias

2017-03-08 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Why was the PR merged while we were still discussing it ?

--

___
Python tracker 

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



[issue29752] Enum._missing_ not called for __getattr__ failures

2017-03-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Could that perhaps be intentional? Attribute access seems like something where 
the developer would be explicitly naming a single, hard coded, canonical name 
for the type, while string construction seems like something where you're 
getting a string from "somewhere" (user input, which is always terrible) and 
you'd want to have a way to handle invalid input.

The documentation is so sparse as to be useless for determining intent:

_missing_ – a lookup function used when a value is not found; may be overridden

I wouldn't view Label.redapple as an attempt to "find" anything, it's just 
simple attribute access.

--
nosy: +josh.r

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-03-08 Thread Serhiy Storchaka

Changes 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



[issue29756] Improve documentation for list methods that compare items by equality

2017-03-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

To be clear, I'm referring to the docs in the tutorial:

https://docs.python.org/3.7/tutorial/datastructures.html

and the docstrings as well as the library reference:

https://docs.python.org/3.7/library/stdtypes.html#sequence-types-list-tuple-range

The library reference already notes that `remove` uses equality, but the others 
do not.

--

___
Python tracker 

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



[issue29756] Improve documentation for list methods that compare items by equality

2017-03-08 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Further to Barry's explanation, you see the same result with any values which 
compare equal:

py> from decimal import Decimal as D
py> [1, 1.0, D(1), True, 1+0j].count(D(1))
5

This is standard behaviour for methods `count`, `remove`, and `index`, but it 
isn't explained well in the documentation. E.g. `remove` says "Remove the first 
item from the list whose value is x` which could be read as meaning that the 
test is done by identity. All three methods need to clarify that ordinary == 
equality is used.


I'm going to re-open the task as a documentation issue.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, steven.daprano
resolution: not a bug -> 
stage: resolved -> 
status: closed -> open
title: List count() counts True as 1 -> Improve documentation for list methods 
that compare items by equality
type:  -> enhancement
versions:  -Python 2.7, Python 3.5

___
Python tracker 

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



[issue29757] The loop in utility `socket.create_connection()` swallows previous errors

2017-03-08 Thread Kostis Anagnostopoulos

New submission from Kostis Anagnostopoulos:

## Context
The utility method `socket.create_connection()` currently works like that:
1. resolve the destination-address into one or more IP(v4 & v6) addresses;
2. loop on each IP address and stop to the 1st one to work;
3. if none works, re-raise the last error.


## The problem
So currently the loop in `socket.create_connection()` ignores all intermediate 
errors and reports only the last connection failure, 
which  might be irrelevant.  For instance, when both IPv4 & IPv6 networks are 
supported, usually the last address is a IPv6 address and it frequently fails 
with an irrelevant error - the actual cause have already been ignored.


## Possible solutions & open questions
To facilitate network debugging, there are at least 3 options:
a. log each failure [as they 
happen](/python/cpython/blob/6f0eb93183519024cb360162bdd81b9faec97ba6/Lib/socket.py#L717),
 but that would get the final failure twice: once as a (warning?) message, and 
once as an exception .
b. collect all failures and log them only when connection fails to collect the 
errors, 
   but that might miss important infos to the user;
c. collect and return all failures in list attached to the raised exception.

A question for cases (a) & (b) is what logging "means" to use: the `warnings` 
or `logging` module?
And if `logging` is chosen, log them in `'DEBUG'` or `'WARNING'` level?

Case (c) sidesteps the above questions.

--
components: Library (Lib)
messages: 289238
nosy: ankostis
priority: normal
pull_requests: 463
severity: normal
status: open
title: The loop in utility `socket.create_connection()` swallows previous errors
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29723] 3.6.1rc1 adds the current directory to sys.path when running a subdirectory's __main__.py; previous versions did not

2017-03-08 Thread Steve Dower

Steve Dower added the comment:

> C:\Temp doesn't belong in sys.path in this case

Hang on, why not? If I were running a module.py then it would be, so why is a 
package\__main__.py different (and not able to import itself or its siblings)? 
The package is the "script" being run here, yes?

Or is __main__.py different from __init__.py in this regard? (That is, it isn't 
*part* of the package, it's just a loose script that happens to inherit the 
name of its directory)

--

___
Python tracker 

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



[issue29756] List count() counts True as 1

2017-03-08 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

bools are subclasses of int and False and True have integer equivalents:

https://docs.python.org/3/library/stdtypes.html#bltin-boolean-values

--
nosy: +barry
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-03-08 Thread Serhiy Storchaka

Changes 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



[issue29756] List count() counts True as 1

2017-03-08 Thread Alexander Todorov

New submission from Alexander Todorov:

When using list.count() I get the following results

>>> [1, 2, 3].count(1)
1
>>> [1, 2, 3, True].count(2)
1
>>> [1, 2, 3, True].count(True)
2
>>> [1, 2, 3, True].count(1)
2

as you can see True is considered the same as 1.  The documentation for the 
count method says:

count(...)
L.count(value) -> integer -- return number of occurrences of value

so IMO the above behavior is wrong. Seeing this on a RHEL 7 system with 
Python 3.5.1 and 2.7.5

--
messages: 289235
nosy: Alexander Todorov
priority: normal
severity: normal
status: open
title: List count() counts True as 1
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue28298] can't set big int-like objects to items in array 'Q', 'L' and 'I'

2017-03-08 Thread Oren Milman

Oren Milman added the comment:

yes and yes.
I would start with a PR for 3.7.

and thanks for the review :)

--

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-03-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +462

___
Python tracker 

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



[issue29747] unittest - assertDoesNotRaise

2017-03-08 Thread Vinícius Dantas

Vinícius Dantas added the comment:

As a last argument:
It is a matter of coherence/consistency with unittest's API, given that
this module does differentiates errors from failures

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Oren Milman

Changes by Oren Milman :


--
pull_requests: +461

___
Python tracker 

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



[issue20087] Mismatch between glibc and X11 locale.alias

2017-03-08 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 08.03.2017 10:37, Serhiy Storchaka wrote:
> 
> The problem is that that table can get incorrect result for non-Linux 
> platforms (or for Linux with old glibc).

Sure, it's a best effort approach.

Also note that on today's systems you often don't have the full set of
locales available anymore - instead these have to either be installed
separately or generated on the target system.

Our locale database works on all these system, regardless of
what's installed or not.

--

___
Python tracker 

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



[issue20087] Mismatch between glibc and X11 locale.alias

2017-03-08 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 08.03.2017 07:27, Benjamin Peterson wrote:
> 
> Why is the X11 locale alias map used at all? It seems like it can only create 
> confusion with libc.

Because it was the only such maintained mapping available at the
time. It's also used for the X.org system, which has a rather strong
focus on user interfaces where locale matter a lot, unlike
the lib C :-)

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This for your preference.

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Oren Milman

Oren Milman added the comment:

sure.

In general, should drafts (like this one) be uploaded here?
or is it always better to open a PR?

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Open a PR. It will be not hard to make small changes after opening it.

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Oren Milman

Oren Milman added the comment:

should I open a PR (even though we didn't give Florent enough time to
respond)?

--

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
nosy: +stutzbach

___
Python tracker 

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



[issue29741] BytesIO methods don't accept integer types, while StringIO counterparts do

2017-03-08 Thread Oren Milman

Oren Milman added the comment:

I wrote a patch, but I attach it here and not in a PR, as you haven't approved
adding tests. (I would be happy to open a PR with or without the tests.)
I ran the test module (on my Windows 10), and seems like the patch doesn't
break anything.

also, while running test_memoryio with my added tests, i noticed some places in
Lib/_pyio.py which seemed like they should be changed.
in particular, I changed 'var.__index__' to 'var = var.__index__()' in some
places.
I feel really uncomfortable about that change, as it undos a change committed
by Florent Xicluna in b14930cd93e74cae3b7370262c6dcc7c28e0e712.
Florent, what was the reason for that change?

--
keywords: +patch
nosy: +flox
Added file: http://bugs.python.org/file46709/patchDraft1.diff

___
Python tracker 

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



[issue10408] Denser dicts and linear probing

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think this issue is outdated. Liner probing doesn't make much sense for 
current dict implementation.

--
status: open -> pending

___
Python tracker 

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



[issue20087] Mismatch between glibc and X11 locale.alias

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The problem is that that table can get incorrect result for non-Linux platforms 
(or for Linux with old glibc).

--

___
Python tracker 

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



[issue20087] Mismatch between glibc and X11 locale.alias

2017-03-08 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 08.03.2017 08:20, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
> Not all platforms use glibc 2.24 as libc.

True. Many don't even use glibc.

> Ideally most of entries should even not exist. We should ask libc for the 
> default encoding if it is not included in the locale name. The aliases table 
> should be used only for mapping commonly used but unsupported by libc locales 
> to supported by libc locales.

I think you have a wrong understanding of what this alias table
is used for: we need it to determine the lib C compatible locale
name without using lib C APIs such as setlocale(), since these are
not thread safe and have side-effects for the whole process.

The alias table is there to avoid having to go to the lib C
to ask it indirectly for more details. Unfortunately, there are
no cross-platform lib C APIs which would allow querying these
details without also changing the local settings of the process.

I know that Python still plays the usual "save current locale,
run setlocale(), revert to previous locale" trick in a couple
of places and this works if Python is the only thread running,
but it doesn't when embedded into other applications.

Regarding the patch: we cannot simply use the output from the
script to set new values. The changes have to be manually
reviewed as well.

E.g. this entry in the table is clearly a typo:

'en_zw.utf8':   'en_ZS.UTF-8',

(it should read en_ZW.UTF-8)

This entry appears wrong as well:

'eo':   'eo_XX.ISO8859-3',

(XX is not a valid country ISO code)

How should we go about this ? Mark all the problems in the PR ?

--

___
Python tracker 

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



[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it is worth to backport this at least to 3.6.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29755] python3 gettext.lgettext sometimes returns bytes, not string

2017-03-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Library (Lib)
nosy: +loewis, serhiy.storchaka
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

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



[issue29755] python3 gettext.lgettext sometimes returns bytes, not string

2017-03-08 Thread Petri Savolainen

New submission from Petri Savolainen:

On Debian stable (Python 3.4), with the LANGUAGE environment variable set to 
"C" or "en_US.UTF-8", the following produces a string:

d = gettext.textdomain('apt-listchanges')
print(gettext.lgettext("Informational notes"))

However, setting the language, for example fi_FI.UTF-8, it will output a bytes 
object. Same apparently happens with some other languages, too.

Why is this? The discrepancy is not documented anywhere, AFAIK. Is this a bug 
or intended behavior depending on some (undocumented) circumstances? Given both 
the above examples define UTF-8 as the encoding, the result value does not 
depend directly on the encoding. 

The docs say lgettext should merely return the translation in a particular 
encoding. It does not say the return value will be switched from a string to 
bytes as well.

I saw this originally in the Debian bug tracker and thought the issue merits at 
least clarification here as well (link to Debian bug below for reference).

(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818728)

No idea if this happens on Python > 3.4 or another platforms. I would guess so, 
but have not had time to confirm.

--
messages: 289220
nosy: petri
priority: normal
severity: normal
status: open
title: python3 gettext.lgettext sometimes returns bytes, not string
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue28230] tarfile does not support pathlib

2017-03-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +460

___
Python tracker 

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



[issue29537] Alternative fix for BUILD_MAP_UNPACK_WITH_CALL opcode in 3.5

2017-03-08 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +459

___
Python tracker 

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



[issue29751] PyLong_FromString fails on decimals with leading zero and base=0

2017-03-08 Thread Mark Dickinson

Mark Dickinson added the comment:

Yes, PyLong_FromString is directly used by the implementation of int, and is 
also used in parsing of numeric integer literals in source:

https://github.com/python/cpython/blob/cb41b2766de646435743b6af7dd152751b54e73f/Python/ast.c#L4084

So I agree that this is a documentation bug. There's also no mention of the 
support for underscores in the documentation.

--

___
Python tracker 

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



[issue28298] can't set big int-like objects to items in array 'Q', 'L' and 'I'

2017-03-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. But maybe combine PyFloat_Check+_PyLong_FromNbInt in one helper function?

Could you please create a PR Oren?

--
stage: patch review -> commit review
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



[issue29754] sorted ignores reverse=True when sorting produces same list

2017-03-08 Thread Tomas Dabašinskas

Tomas Dabašinskas added the comment:

Thanks for taking time to review and respond Tim! (;

--

___
Python tracker 

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



[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-03-08 Thread STINNER Victor

STINNER Victor added the comment:

On Windows, _Py_attribute_data_to_stat() converts BY_HANDLE_FILE_INFORMATION to 
_Py_stat_struct, and then _pystat_fromstructstat() creates Python objects.

The file index in BY_HANDLE_FILE_INFORMATION is made of two DWORD, so yes, it's 
unsigned.

On Linux, stat.st_ino type is ino_t which is unsigned too.

So I created a pull request to fix the bug, even if I don't think that a 
filesystem produce inodes larger than 2^63-1. Not sure if it's worth it to 
backport the fix to Python 2.7, 3.5 and 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



[issue29619] st_ino (unsigned long long) is casted to long long in posixmodule.c:_pystat_fromstructstat

2017-03-08 Thread STINNER Victor

Changes by STINNER Victor :


--
pull_requests: +458

___
Python tracker 

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