[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aa52ea2a7731 by Victor Stinner in branch '3.6':
Fix warn_invalid_escape_sequence()
https://hg.python.org/cpython/rev/aa52ea2a7731

--
nosy: +python-dev

___
Python tracker 

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



[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Thanks Serhiy for your unit tests! I pushed with patch with your tests.

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



[issue28693] No HKSCS support in Windows cp950

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Python supports native Windows code pages using
codecs.code_page_encode() and codecs.code_page_decode() methods. See
for example Lib/encodings/cp65001.py : this codec is not implemented
in Python, but is a wrapper to native Windows functions
(MultiByteToWideChar and WideCharToMultiByte).

--

___
Python tracker 

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



[issue28690] Loop in re (regular expression) processing

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

It's not really a bug, but more a trap of regular expressions. It seems like 
you fixed your issue, so I close it.

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



[issue28695] Add SSL_CTX_set_client_cert_engine

2016-11-15 Thread Christian Heimes

Changes by Christian Heimes :


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



[issue28695] Add SSL_CTX_set_client_cert_engine

2016-11-15 Thread Christian Heimes

New submission from Christian Heimes:

Python's ssl module does not support smartcard authentication of clients.
In order to use an external engine like OpenSC's engine_pkcs11, SSLContext must 
be configured to use a loaded engine for client cert auth. It's really simple. 
Pseudo code without error reporting, engine_id is a char*:

ENGINE *e = ENGINE_by_id(engine_id);
SSL_CTX_set_client_cert_engine(ctx, e);

--
assignee: christian.heimes
components: SSL
messages: 280830
nosy: christian.heimes
priority: normal
severity: normal
stage: needs patch
status: open
title: Add SSL_CTX_set_client_cert_engine
type: behavior

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread INADA Naoki

INADA Naoki added the comment:

> I don't understand well the effect of the hot attribute

I compared lookdict_unicode_nodummy assembly by `objdump -d dictobject.o`.
It looks completely same.

So I think only difference is placement. hot functions are in .text.hot section 
and linker
groups hot functions. This reduces cache hazard possibility.

When compiling Python with PGO, we can see what function is hot by objdump.

```
~/work/cpython/Objects$ objdump -tj .text.hot dictobject.o

dictobject.o: file format elf64-x86-64

SYMBOL TABLE:
 ld  .text.hot   .text.hot
07a0 l F .text.hot  0574 
lookdict_unicode_nodummy
46d0 l F .text.hot  00e8 free_keys_object
01c0 l F .text.hot  0161 new_keys_object
03b0 l F .text.hot  03e8 insertdict
1180 l F .text.hot  081f dictresize
19a0 l F .text.hot  0165 find_empty_slot.isra.0
2180 l F .text.hot  05f1 lookdict
1b10 l F .text.hot  00c2 unicode_eq
2780 l F .text.hot  0184 dict_traverse
4c20 l F .text.hot  05f7 lookdict_unicode
6b20 l F .text.hot  0330 lookdict_split
...
```

cold section of hot function is placed in .text.unlikely section.

```
$ objdump -t  dictobject.o  | grep lookdict
07a0 l F .text.hot  0574 
lookdict_unicode_nodummy
2180 l F .text.hot  05f1 lookdict
013e l   .text.unlikely  
lookdict_unicode_nodummy.cold.6
0a38 l   .text.unlikely  lookdict.cold.15
4c20 l F .text.hot  05f7 lookdict_unicode
6b20 l F .text.hot  0330 lookdict_split
1339 l   .text.unlikely  
lookdict_unicode.cold.28
1d01 l   .text.unlikely  lookdict_split.cold.42
```

All lookdict* function are put in hot section, and all of cold part is 0 byte.
It seems PGO put all lookdict* functions in hot section.

compiler info:
```
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 
5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs 
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-5 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib 
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home 
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar 
--enable-objc-gc --enable-multiarch --disable-werror --wi
 th-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 
--enable-multilib --with-tune=generic --enable-checking=release 
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
```

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread INADA Naoki

INADA Naoki added the comment:

> so I suggest to run benchmarks and check that it has a non negligible effect 
> on benchmarks ;-)

When added _Py_HOT_FUNCTION to lookdict_unicode, lookdict_unicode_nodummy and 
lookdict_split
(I can't measure L1 miss via `perf stat -d` because I use EC2 for benchmark):

$ ~/local/python-master/bin/python3 -m perf compare_to -G all-master.json 
all-patched.json
Slower (28):
- pybench.CompareFloats: 106 ns +- 1 ns -> 112 ns +- 1 ns: 1.07x slower
- pybench.BuiltinFunctionCalls: 1.62 us +- 0.00 us -> 1.68 us +- 0.03 us: 1.04x 
slower
- pybench.CompareFloatsIntegers: 180 ns +- 3 ns -> 185 ns +- 3 ns: 1.03x slower
- sympy_sum: 163 ms +- 7 ms -> 167 ms +- 7 ms: 1.03x slower
- deltablue: 13.7 ms +- 0.4 ms -> 14.1 ms +- 0.5 ms: 1.02x slower
- pickle_list: 5.77 us +- 0.09 us -> 5.90 us +- 0.07 us: 1.02x slower
- pybench.PythonFunctionCalls: 1.20 us +- 0.02 us -> 1.22 us +- 0.02 us: 1.02x 
slower
- pybench.SpecialClassAttribute: 1.46 us +- 0.02 us -> 1.49 us +- 0.03 us: 
1.02x slower
- pybench.TryRaiseExcept: 207 ns +- 4 ns -> 210 ns +- 0 ns: 1.02x slower
- pickle_pure_python: 868 us +- 18 us -> 882 us +- 16 us: 1.02x slower
- genshi_text: 56.0 ms +- 0.7 ms -> 56.8 ms +- 0.6 ms: 1.01x slower
- json_dumps: 19.5 ms +- 0.3 ms -> 19.8 ms +- 0.2 ms: 1.01x slower
- richards: 137 ms +- 3 ms -> 139 ms +- 2 ms: 1.01x slower
- sqlalchemy_declarative: 272 ms +- 4 ms -> 276 ms +- 3 ms: 1.01x slower
- pickle_dict: 43.5 us +- 0.4 us -> 44.1 us +- 0.2 us: 1.01x slower
- go: 436 ms +- 4 ms -> 441 ms +- 4 ms: 1.01x slower
- pybench.SecondImport: 2.52 us +- 0.04 us -> 2.55 us +- 0.07 us: 1.01x slower
- pybench.NormalClassAttribute: 1.46 us +- 0.02 us -> 1.47 us +- 0.02 us: 1.01x 
slower
- genshi_xml: 118 ms +- 2 ms -> 118 ms +- 3 ms: 1.01x slower
- pybench.UnicodePredicates: 75.8 ns +- 0.6 ns -> 76.2 ns +- 0.9 ns: 1.01x 
slower
- pybench.ListSlicing: 415 us +- 4 us -> 417 us +- 4 us: 1.01x slower
- scimark_fft: 494 ms +- 2 ms -> 496 ms +- 12 ms: 1.01x slower
- logging_format: 23.7 us +- 0.3 us -> 23.9 us +- 0.4 us: 1.00x slower
- chaos: 200 ms +- 1 ms -> 201 ms +- 1 ms: 1.00x slower
- pybench.StringPredicates: 509 ns +- 3 ns -> 511 ns +- 4 ns: 1.00x slower
- call_method: 13.6 ms +- 0.1 ms -> 13.7 ms +- 0.2 ms: 1.00x slower
- pybench.StringSlicing: 530 ns +- 3 ns -> 532 ns +- 8 ns: 1.00x slower
- pybench.SimpleLongArithmetic: 535 ns +- 2 ns -> 536 ns +- 4 ns: 1.00x slower

Faster (47):
- html5lib: 169 ms +- 7 ms -> 158 ms +- 6 ms: 1.07x faster
- pybench.ConcatUnicode: 57.3 ns +- 3.0 ns -> 55.8 ns +- 1.3 ns: 1.03x faster
- pybench.IfThenElse: 60.5 ns +- 1.0 ns -> 59.0 ns +- 0.7 ns: 1.02x faster
- logging_silent: 606 ns +- 14 ns -> 593 ns +- 13 ns: 1.02x faster
- scimark_lu: 411 ms +- 5 ms -> 404 ms +- 4 ms: 1.02x faster
- pathlib: 29.1 ms +- 0.3 ms -> 28.7 ms +- 0.5 ms: 1.02x faster
- pybench.CreateStringsWithConcat: 2.87 us +- 0.01 us -> 2.82 us +- 0.00 us: 
1.02x faster
- pybench.DictCreation: 621 ns +- 10 ns -> 612 ns +- 8 ns: 1.01x faster
- meteor_contest: 167 ms +- 5 ms -> 164 ms +- 5 ms: 1.01x faster
- unpickle_pure_python: 656 us +- 19 us -> 647 us +- 9 us: 1.01x faster
- pybench.NestedForLoops: 20.2 ns +- 0.1 ns -> 20.0 ns +- 0.1 ns: 1.01x faster
- regex_effbot: 4.01 ms +- 0.07 ms -> 3.95 ms +- 0.06 ms: 1.01x faster
- pybench.CreateUnicodeWithConcat: 57.1 ns +- 0.2 ns -> 56.4 ns +- 0.2 ns: 
1.01x faster
- chameleon: 18.3 ms +- 0.2 ms -> 18.0 ms +- 0.3 ms: 1.01x faster
- python_startup: 13.7 ms +- 0.1 ms -> 13.5 ms +- 0.1 ms: 1.01x faster
- pybench.SmallTuples: 967 ns +- 6 ns -> 955 ns +- 8 ns: 1.01x faster
- pybench.TryFinally: 200 ns +- 3 ns -> 198 ns +- 2 ns: 1.01x faster
- pybench.SimpleIntegerArithmetic: 425 ns +- 3 ns -> 420 ns +- 4 ns: 1.01x 
faster
- pybench.Recursion: 1.34 us +- 0.02 us -> 1.33 us +- 0.03 us: 1.01x faster
- pybench.SimpleIntFloatArithmetic: 424 ns +- 1 ns -> 420 ns +- 1 ns: 1.01x 
faster
- float: 222 ms +- 2 ms -> 220 ms +- 3 ms: 1.01x faster
- 2to3: 531 ms +- 4 ms -> 527 ms +- 5 ms: 1.01x faster
- python_startup_no_site: 8.30 ms +- 0.04 ms -> 8.23 ms +- 0.05 ms: 1.01x faster
- xml_etree_parse: 196 ms +- 5 ms -> 194 ms +- 2 ms: 1.01x faster
- pybench.ComplexPythonFunctionCalls: 794 ns +- 7 ns -> 788 ns +- 7 ns: 1.01x 
faster
- logging_simple: 20.4 us +- 0.2 us -> 20.3 us +- 0.4 us: 1.01x faster
- fannkuch: 795 ms +- 9 ms -> 790 ms +- 3 ms: 1.01x faster
- hexiom: 18.7 ms +- 0.1 ms -> 18.6 ms +- 0.1 ms: 1.01x faster
- regex_compile: 322 ms +- 9 ms -> 320 ms +- 8 ms: 1.01x faster
- mako: 36.0 ms +- 0.1 ms -> 35.8 ms +- 0.2 ms: 1.01x faster
- pybench.UnicodeProperties: 91.7 ns +- 0.9 ns -> 91.1 ns +- 0.8 ns: 1.01x 
faster
- pybench.SimpleComplexArithmetic: 577 ns +- 8 ns -> 573 ns +- 3 ns: 1.01x 
faster
- xml_etree_process: 147 ms +- 2 ms -> 146 ms +- 2 ms: 1.01x faster
- pybench.CompareUnicode: 22.4 ns +- 0.1 ns -> 22.2 ns +- 0.1 ns: 1.01x faster
- crypto_pyaes: 175 ms +- 1 ms -> 174 ms +- 1 ms: 1.01x faster
- unpickle_list: 5.43 us +- 0.04 us -> 5.41 us +- 0.02 us: 1.01x

[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Lev Veshnyakov

New submission from Lev Veshnyakov:

It's only in imap, in map it's ok. The following code explains the issue:


from multiprocessing.pool import ThreadPool

pool = ThreadPool(10)

def gen():
yield 1 + '1' # here is an error

try:
next((pool.imap(str, gen(
except:
# Will be catched using pool.map normally, but using pool.imap will be not.
# Instead it hangs. This is the same for ThreadPool and Pool.
print('this will not be printed because thread is hanging')

--
components: Library (Lib)
files: test.py
messages: 280833
nosy: lev-veshnyakov
priority: normal
severity: normal
status: open
title: imap from ThreadPool hangs by an exception in a generator function
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file45486/test.py

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

_PyUnicode_FromId would not fail due to bad encoded data if use the Latin1 
encoding. Seems encoded data always is ASCII. We could use 
PyErr_WriteUnraisable() for output a warning if it is not.

--

___
Python tracker 

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



[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, of cause. Thank your for noticing this.

--
Added file: 
http://bugs.python.org/file45487/gettext-non-int-plural-deprecate.patch

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 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



[issue28082] re: convert re flags to (much friendlier) IntFlag constants

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

The change 5fd69d4a93e0 (use IntFlag for re constants) made the "regex_compile" 
benchmark slower:

Median +- std dev: [71c1970f27b6] 388 ms +- 3 ms -> [3cf248d10bed] 470 ms +- 4 
ms: 1.21x slower

--

___
Python tracker 

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



[issue27838] test_os.test_chown() failure on koobs-freebsd-{current, 9}

2016-11-15 Thread Kubilay Kocak

Kubilay Kocak added the comment:

@Serhiy

I have noticed that the failure is reproducible in the buildbot workers only 
when startup (of buildbot) is invoked via sudo, and not when started on 
first-boot (rc runs as root). 

In both situations, twistd then drops privs to --uid=buildbot --gid=buildbot). 

However, I *cannot* reproduce the failure (python -m test.regrtest test_os) on 
a clean checkout and build of 3.x either under a normal user, *or* under sudo.

I think we need some instrumentation added to test to see whats happening. 

We can add that instrumentation and also test your patch committed to a private 
hg branch using the 'custom' builder.

I can also provide SSH access to the buildbot hosts.

--

___
Python tracker 

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



[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Davin Potts

Davin Potts added the comment:

Using the supplied example, I was unable to reproduce what you described using 
either 3.5 or 3.6-beta on OS X 10.11.

What platform are you using?  (Perhaps it is platform specific.)

--
nosy: +davin

___
Python tracker 

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



[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-15 Thread Xiang Zhang

Xiang Zhang added the comment:

I think the stacklevel should be 3.

stacklevel = 3:

./python -Walways /tmp/a.py 
/tmp/a.py:2: DeprecationWarning: Plural value must be an integer, got float
  c2py('n!=1')(1.1)

stacklevel = 4:

./python -Walways /tmp/a.py 
sys:1: DeprecationWarning: Plural value must be an integer, got float

--

___
Python tracker 

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



[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Lev Veshnyakov

Lev Veshnyakov added the comment:

Ubuntu 14.04 LTS, 3.13.0-83-generic, x86_64

--

___
Python tracker 

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



[issue28692] gettext: deprecate selecting plural form by fractional numbers

2016-11-15 Thread Xiang Zhang

Xiang Zhang added the comment:

Ohh, sorry. It should be 4 and I make a mistake. Sorry for the noise. Patch 
LGTM.

--

___
Python tracker 

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



[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Lev Veshnyakov

Lev Veshnyakov added the comment:

So, I've checked twice, it's presented by me on python 3.4.3, and not by 3.5.2. 
So I will go deaper

--

___
Python tracker 

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



[issue24329] __qualname__ and __slots__

2016-11-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
versions: +Python 3.5

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Please don't modify _PyUnicode_FromId(), I prefer to keep it as it is, decode 
from UTF-8.

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cfc956f13ce2 by Victor Stinner in branch 'default':
Issue #28618: Mark dict lookup functions as hot
https://hg.python.org/cpython/rev/cfc956f13ce2

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

> How about marking lookdict_unicode and lookdict_unicode_nodummy as hot?

Ok, your benchmark results doens't look bad, so I marked the following 
functions as hot:

- lookdict
- lookdict_unicode
- lookdict_unicode_nodummy
- lookdict_split

It's common to see these functions in the top 3 of "perf report".

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

hot3.patch: Mark additional functions as hot

* PyNumber_AsSsize_t()
* _PyUnicode_FromUCS1()
* json: scanstring_unicode()
* siphash24()
* sre_ucs1_match, sre_ucs2_match, sre_ucs4_match

I'm not sure about this patch. It's hard to get reliable benchmark results on 
microbenchmarks :-/ It's hard to understand if a speedup comes from the hot 
attribute, or if the compiler decided itself to change the code placement. 
Without the hot attribute, the code placement seems random.

--
Added file: http://bugs.python.org/file45488/hot3.patch

___
Python tracker 

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



[issue28343] Bad encoding alias cp936 -> gbk: euro sign

2016-11-15 Thread Mingye Wang

Mingye Wang added the comment:

Also, go to 
ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit936.txt
 for MS reference.

--

___
Python tracker 

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



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-11-15 Thread Martijn Pieters

Martijn Pieters added the comment:

This bug affects all use of `file.__iter__` and interrupts (EINTR), not just 
sys.stdin.

You can reproduce the issue by reading from a (slow) pipe in a terminal window 
and resizing that window, for example; the interrupt is not handled and a 
future call ends up raising `IOError: [Errno 0] Error`, a rather confusing 
message.

The Mercurial community is switching away from using direct iteration over this 
bug; Jun's excellent analysis is included and enlightening:

   
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-November/090522.html

The fix is to use

interrupted = ferror(f->f_fp) && errno == EINTR;
// ..
if (interrupted) {
clearerr(f->f_fp);
if (PyErr_CheckSignals()) {
Py_DECREF(v);
return NULL;
}
}

and check for interrupted == 0 in the chunksize == 0 case after 
Py_UniversalNewlineFread calls, as file_read does, for example, but which 
readahead doesn't (where the only public user of readahead is file_iternext).

--
nosy: +mjpieters

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

I wrote hot3.patch when trying to make the following benchmarks more reliable:

- logging_silent: rev 8ebaa546a033 is 20% slower than the average en 2016
- json_loads: rev 0bd618fe0639 is 30% slower and rev 8ebaa546a033 is
15% slower than the average on 2016
- regex_effbot: rev 573bc1f9900e (nov 7) takes 6.0 ms, rev
cf7711887b4a (nov 7) takes 5.2 ms, rev 8ebaa546a033 (nov 10) takes 6.1
ms, etc.

--

___
Python tracker 

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



[issue21090] File read silently stops after EIO I/O error

2016-11-15 Thread Martijn Pieters

Martijn Pieters added the comment:

The Python 2.7 issue (using fread without checking for interrupts) looks like a 
duplicate of http://bugs.python.org/issue1633941

--
nosy: +mjpieters

___
Python tracker 

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



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-11-15 Thread Martijn Pieters

Martijn Pieters added the comment:

It looks like readahead was missed when http://bugs.python.org/issue12268 was 
fixed.

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> * json: scanstring_unicode()

This doesn't look wise. This is specific to single extension module and perhaps 
to single particular benchmark. Most Python code don't use json at all.

What is the top of "perf report"? How this list intersects with the list of 
functions in .text.hot section of PGO build? Make several PGO builds (perhaps 
on different computers). Is .text.hot section stable?

--

___
Python tracker 

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



[issue12268] file readline, readlines & readall methods can lose data on EINTR

2016-11-15 Thread Martijn Pieters

Martijn Pieters added the comment:

Follow-up bug, readahead was missed: http://bugs.python.org/issue1633941

--
nosy: +mjpieters

___
Python tracker 

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



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Martijn Pieters: Sadly, Python 2 I/O are full of bugs in corner cases :-/

First of all, in most cases, Python 2 uses the libc for I/O, but the libc has 
known bugs including segfaults:
https://haypo-notes.readthedocs.io/python.html#bugs-in-the-c-stdio-used-by-the-python-i-o

Python 3 is better to handle EINTR. EINTR should now be "fully supported" in 
Python 3.5 thanks for the PEP 475. I mean in the Python core, I don't expect 
that any third party implement the PEP 475. Hopefully, most third party module 
don't implement syscall wrappers themself, but reuse Python which handles EINTR 
for them.

To come back to Python 2: yeah, we still have to fix issues to make the code 
more robust in corner cases, and enhance error reporting. It seems like fread() 
errors are not checked correctly in some places.

--
nosy: +haypo

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Please don't modify _PyUnicode_FromId(), I prefer to keep it as it is, decode 
> from UTF-8.

Then we should add handling of three special cases: PyUnicode_READY() fails, 
_PyUnicode_FromId() fails and both fail due to memory error. This means that 
should be implemented character-by-character encoding of UCS1, UCS2, UCS4 or 
wchar_t (with possible surrogate pairs) to UTF-8 and comparing with UTF-8 
encoded data.

--

___
Python tracker 

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



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

I don't see any simple solution to get a 100% reliable I/O stack on Python 2.

Python 3.5 contains a pure Python implementation of the io module: _pyio.FileIO 
uses os.read() and os.write(). In Python 3.4 and older, the _pyio still used 
io.FileIO (implemented in C). But try to recall Python 3.0 which had *very* bad 
I/O performance because its io module was fully implemented in pure Python!

The uvloop project proved that Python can be very efficient for (network) I/O 
using code written with Cython. But I also know that Mercurial cares of PyPy 
which is not really Cython-friendly.

Even if fread() bugs are fixed in Python 2.7.x+1, you will still hit bugs on 
Python 2.7.x and older.

Maybe it can be a strong motivation to pursue your Python 3 efforts :-)

--

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

> This issue is not just about readability or performance. It is about 
> correctness, since none of callers check for failure of 
> _PyUnicode_CompareWithId.

Callers should be fixed to handle errors.

--

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread Xiang Zhang

Xiang Zhang added the comment:

Since currently _PyUnicode_CompareWithId is used to compare a unicode with 
ascii identifiers for all cases, how about introduce a more specific function 
like _PyUnicode_EqualToASCIIId for this case? We can preserve 
_PyUnicode_CompareWithId for more general purpose usage. It's much easier to 
write a error free _PyUnicode_EqualToASCIIId.

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset cfc956f13ce2 by Victor Stinner in branch 'default':
> Issue #28618: Mark dict lookup functions as hot
> https://hg.python.org/cpython/rev/cfc956f13ce2

Here are benchmark results on the speed-python server:

haypo@speed-python$ PYTHONPATH=~/perf python -m perf compare_to 
2016-11-15_09-12-default-ac93d188ebd6.json 
2016-11-15_15-13-default-cfc956f13ce2.json -G --min-speed=1
Slower (6):
- json_loads: 62.8 us +- 1.1 us -> 65.8 us +- 2.6 us: 1.05x slower
- nbody: 243 ms +- 2 ms -> 253 ms +- 6 ms: 1.04x slower
- mako: 42.7 ms +- 0.2 ms -> 43.5 ms +- 0.3 ms: 1.02x slower
- chameleon: 29.2 ms +- 0.3 ms -> 29.7 ms +- 0.2 ms: 1.02x slower
- spectral_norm: 261 ms +- 2 ms -> 266 ms +- 3 ms: 1.02x slower
- pickle: 26.6 us +- 0.4 us -> 27.0 us +- 0.4 us: 1.01x slower

Faster (26):
- xml_etree_generate: 290 ms +- 4 ms -> 275 ms +- 3 ms: 1.06x faster
- float: 306 ms +- 5 ms -> 292 ms +- 7 ms: 1.05x faster
- logging_simple: 37.7 us +- 0.4 us -> 36.1 us +- 0.4 us: 1.04x faster
- hexiom: 25.6 ms +- 0.1 ms -> 24.5 ms +- 0.1 ms: 1.04x faster
- regex_effbot: 6.11 ms +- 0.31 ms -> 5.88 ms +- 0.43 ms: 1.04x faster
- sympy_expand: 1.19 sec +- 0.02 sec -> 1.15 sec +- 0.01 sec: 1.04x faster
- telco: 21.5 ms +- 0.4 ms -> 20.8 ms +- 0.4 ms: 1.03x faster
- raytrace: 1.41 sec +- 0.02 sec -> 1.37 sec +- 0.02 sec: 1.03x faster
- scimark_sor: 512 ms +- 11 ms -> 500 ms +- 12 ms: 1.03x faster
- logging_format: 44.6 us +- 0.5 us -> 43.6 us +- 0.7 us: 1.02x faster
- sympy_str: 532 ms +- 4 ms -> 520 ms +- 4 ms: 1.02x faster
- fannkuch: 1.11 sec +- 0.01 sec -> 1.08 sec +- 0.02 sec: 1.02x faster
- django_template: 475 ms +- 5 ms -> 467 ms +- 6 ms: 1.02x faster
- chaos: 308 ms +- 2 ms -> 303 ms +- 3 ms: 1.02x faster
- xml_etree_process: 244 ms +- 4 ms -> 240 ms +- 4 ms: 1.02x faster
- xml_etree_iterparse: 225 ms +- 5 ms -> 221 ms +- 4 ms: 1.02x faster
- pathlib: 51.1 ms +- 0.5 ms -> 50.3 ms +- 0.5 ms: 1.02x faster
- sqlite_synth: 10.5 us +- 0.2 us -> 10.3 us +- 0.2 us: 1.01x faster
- dulwich_log: 186 ms +- 1 ms -> 184 ms +- 1 ms: 1.01x faster
- sqlalchemy_imperative: 72.5 ms +- 1.6 ms -> 71.5 ms +- 1.6 ms: 1.01x faster
- deltablue: 18.5 ms +- 0.3 ms -> 18.3 ms +- 0.2 ms: 1.01x faster
- tornado_http: 438 ms +- 5 ms -> 433 ms +- 5 ms: 1.01x faster
- json_dumps: 30.4 ms +- 0.4 ms -> 30.1 ms +- 0.4 ms: 1.01x faster
- genshi_xml: 212 ms +- 3 ms -> 210 ms +- 3 ms: 1.01x faster
- scimark_monte_carlo: 273 ms +- 5 ms -> 271 ms +- 5 ms: 1.01x faster
- call_simple: 13.3 ms +- 0.3 ms -> 13.2 ms +- 0.4 ms: 1.01x faster

Benchmark hidden because not significant (32): 2to3, call_method, 
call_method_slots, call_method_unknown, crypto_pyaes, genshi_text, go, 
html5lib, logging_silent, meteor_contest, nqueens, pickle_dict, pickle_list, 
pickle_pure_python, pidigits, python_startup, python_startup_no_site, 
regex_compile, regex_dna, regex_v8, richards, scimark_fft, scimark_lu, 
scimark_sparse_mat_mult, sqlalchemy_declarative, sympy_integrate, sympy_sum, 
unpack_sequence, unpickle, unpickle_list, unpickle_pure_python, xml_etree_parse

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Serhiy Storchaka:
>> * json: scanstring_unicode()
>
> This doesn't look wise. This is specific to single extension module and 
> perhaps to single particular benchmark. Most Python code don't use json at 
> all.

Well, I tried different things to make these benchmarks more stable. I didn't 
say that we should merge hot3.patch as it is :-) It's just an attempt.


> What is the top of "perf report"?

For json_loads, it's:

 14.99%  _json.cpython-37m-x86_64-linux-gnu.so  scanstring_unicode
  8.34%  python _PyUnicode_FromUCS1
  8.32%  _json.cpython-37m-x86_64-linux-gnu.so  scan_once_unicode
  8.01%  python lookdict_unicode_nodummy
  6.72%  python siphash24
  4.45%  python PyDict_SetItem
  4.26%  python _PyObject_Malloc
  3.38%  python _PyEval_EvalFrameDefault
  3.16%  python _Py_HashBytes
  2.72%  python PyUnicode_New
  2.36%  python PyLong_FromString
  2.25%  python _PyObject_Free
  2.02%  libc-2.19.so   __memcpy_sse2_unaligned
  1.61%  python PyDict_GetItem
  1.40%  python dictresize
  1.24%  python unicode_hash
  1.11%  libc-2.19.so   _int_malloc
  1.07%  python unicode_dealloc
  1.00%  python free_keys_object

Result produced with:

   $ perf record ./python ~/performance/performance/benchmarks/bm_json_loads.py 
--worker -v -l 128 -w0 -n 100   
   
   $ perf report  


> How this list intersects with the list of functions in .text.hot section of 
> PGO build?

I checked which functions are considered as "hot" by a PGO build: I found more 
than 2,000 functions... I'm not interested to tag so many functions with 
_Py_HOT_FUNCTIONS. I would prefer to only tag something like the top 10 or top 
25 functions.

I don't know the recommandations to tag functions as hot. I guess that what 
matters is the total size of hot functions. Should I be smaller than the L2 
cache? Smaller than the L3 cache? I'm talking about instructions, but data 
share also these caches...


> Make several PGO builds (perhaps on different computers). Is .text.hot 
> section stable?

In my experience PGO builds don't provide stable performances, but I was never 
able to write an article on that because of so many bugs :-)

--

___
Python tracker 

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



[issue28697] asyncio.Lock, Condition, Semaphore docs don't mention `async with` syntax

2016-11-15 Thread Ulrich Petri

New submission from Ulrich Petri:

The docs for asyncio's Lock, Condition and Semaphore should use the new clean 
`async with lock:` syntax instead of the older (and IMO rather ugly) `with 
(yield from lock):` version.

--
assignee: docs@python
components: Documentation, asyncio
messages: 280861
nosy: docs@python, gvanrossum, ulope, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.Lock, Condition, Semaphore docs don't mention `async with` syntax
versions: 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



[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Lev Veshnyakov

Lev Veshnyakov added the comment:

I've reproduced it on 2 different machines:

- on a MacBook in Docker (debian:jessie, python 3.4.2)
- on another desktop (Ubuntu 14.04.1, 3.16.0-77-generic, x86_64, python 3.4.3)

--

___
Python tracker 

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



[issue28668] instanciation of multiprocessing.Queue raises ImportError in test_logging

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a377e6987821 by Xavier de Gaye in branch '3.5':
Issue 28668: Skip tests where instanciation of multiprocessing.Queue
https://hg.python.org/cpython/rev/a377e6987821

New changeset e5404ba1b19e by Xavier de Gaye in branch '3.6':
Issue 28668: Merge 3.5
https://hg.python.org/cpython/rev/e5404ba1b19e

New changeset 1f0b0ecf7dc1 by Xavier de Gaye in branch 'default':
Issue 28668: Merge 3.6
https://hg.python.org/cpython/rev/1f0b0ecf7dc1

--
nosy: +python-dev

___
Python tracker 

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



[issue26929] android: test_strptime fails

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3c6e5f83d235 by Xavier de Gaye in branch '3.6':
Issue #26929: Skip some test_strptime tests failing on Android that
https://hg.python.org/cpython/rev/3c6e5f83d235

New changeset 91e0cf7f8e30 by Xavier de Gaye in branch 'default':
Issue #26929: Merge 3.6
https://hg.python.org/cpython/rev/91e0cf7f8e30

--
nosy: +python-dev

___
Python tracker 

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



[issue1633941] for line in sys.stdin: doesn't notice EOF the first time

2016-11-15 Thread Jun Wu

Jun Wu added the comment:

haypo: The file.__iter__ EINTR issue may be better discussed as a separate bug 
report. It's not related to stdin or EOF or Windows.

Since we have some EINTR fixes for Python 2.7.4, I think it's reasonable to fix 
the remaining EINTR issues for 2.7.13+.

If I have read fileobject.c correctly, readahead() is the only remaining place 
having the EINTR issue.

If you agree that we should fix readahead(), I can prepare the patch.

--
nosy: +quark

___
Python tracker 

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



[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Lev Veshnyakov

Lev Veshnyakov added the comment:

It's hanging in a while loop in _handle_workers, 
/usr/lib/python3.4/multiprocessingpool.py:365.
I can't figure out what is the reason.

@staticmethod
def _handle_workers(pool):
thread = threading.current_thread()

# Keep maintaining workers until the cache gets drained, unless the pool
# is terminated.
while thread._state == RUN or (pool._cache and thread._state != TERMINATE):
pool._maintain_pool()
time.sleep(0.1)
# send sentinel to stop workers
pool._taskqueue.put(None)
util.debug('worker handler exiting')

--

___
Python tracker 

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



[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Davin Potts

Davin Potts added the comment:

If it only occurs in 3.4.x, is moving to 3.5 an option for you?

--
versions:  -Python 3.5

___
Python tracker 

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



[issue28696] imap from ThreadPool hangs by an exception in a generator function

2016-11-15 Thread Lev Veshnyakov

Lev Veshnyakov added the comment:

Yes, I'm free to move to 3.5, now I'm seeing isn't there any problems in 3.5 
according to this issue.

--

___
Python tracker 

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



[issue28698] Python 3.x ctypes c_wchar_p return is different from official documentation example

2016-11-15 Thread Alex Wang

New submission from Alex Wang:

- Python Version

Python 3.5.2

- Issue

I found that the c_wchar_p and c_char_p return results behaves different from 
what it is based on ctypes doc. From the ctypes doc of Python 3.5:

>>> c_wchar_p("Hello, World")
c_wchar_p('Hello, World')

It return the ctypes string. But my results of execute the same cmd in 
Python3.5 console:

>>> from ctypes import *
>>> c_wchar_p("Hello, World")
c_wchar_p(1374004842736)
>>> c_wchar_p("Hello, World")
c_wchar_p(1374004841680)
>>> c_wchar_p("Hello, World")
c_wchar_p(1374004842736)

So seems like the orignial string part replaced by memory address. Digged in 
more, and found out if it is Python 2.x, then the return shows the string like 
the Python 3.5 ctypes doc shows. But in Python 3.x, it always return these 
numbers. Checked on multiple PCs, all seen the same thing. And understood the 
part that, we can use .value to return the original string. Same thing observed 
on create_string_buffer() and create_unicode_buffer(). Meanwhile, for other 
data types like c_int(), c_bool, c_void_p etc., not see this.

- Question

Can anyone provide a explaination about this behavior of ctypes?
And is there any way to fix the Python3.x return resuls as the same as what is 
doc wrote? (It seems that when it behave like this, I had issue with passing 
Python string to C function, when I interact with a C DLL.)

- Repro

This can be reproduce in python.org/shell easily.

Thanks a lot in advance~

--
components: ctypes
messages: 280869
nosy: Alex Wang
priority: normal
severity: normal
status: open
title: Python 3.x ctypes c_wchar_p return is different from official 
documentation example
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue28556] typing.py upgrades

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset da2ac103d326 by Guido van Rossum in branch '3.5':
Issue #28556: Allow keyword syntax for NamedTuple (Ivan Levkivskyi) (upstream 
#321)
https://hg.python.org/cpython/rev/da2ac103d326

New changeset 38ec88a4e282 by Guido van Rossum in branch '3.6':
Issue #28556: Allow keyword syntax for NamedTuple (Ivan Levkivskyi) (upstream 
#321) (3.5->3.6)
https://hg.python.org/cpython/rev/38ec88a4e282

New changeset a3de2d0f49ea by Guido van Rossum in branch 'default':
Issue #28556: Allow keyword syntax for NamedTuple (Ivan Levkivskyi) (upstream 
#321) (3.6->3.7)
https://hg.python.org/cpython/rev/a3de2d0f49ea

--

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Callers should be fixed to handle errors.

This would make the code of callers more complex for small benefit. And perhaps 
we will add more callers (if replace PyUnicode_CompareWithASCII with new 
function).

> Since currently _PyUnicode_CompareWithId is used to compare a unicode with 
> ascii identifiers for all cases, how about introduce a more specific function 
> like _PyUnicode_EqualToASCIIId for this case?

Great idea Xiang!

--

___
Python tracker 

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



[issue28699] Imap from ThreadPool behaves unexpectedly

2016-11-15 Thread Lev Veshnyakov

New submission from Lev Veshnyakov:

Consider the following code:

from multiprocessing.pool import ThreadPool

pool = ThreadPool(10)

def gen():
yield 1 + '1' # here is an error

print(list(pool.imap(str, gen( # prints []
print(list(pool.map(str, gen( # raises TypeError

The difference is, that the line with imap prints an empty list, while the line 
with map raises an exception, as expected.

Change the above snippet of code, adding additional yield statement:

from multiprocessing.pool import ThreadPool

pool = ThreadPool(10)

def gen():
yield 1
yield 1 + '1' # here is an error

print(list(pool.imap(str, gen( # raises TypeError
print(list(pool.map(str, gen( # also would raise TypeError

So now both map and imap will raise the exception, as expected. Therefore I 
suppose the behavior of imap showed in the first case is wrong.

--
components: Library (Lib)
messages: 280872
nosy: lev-veshnyakov
priority: normal
severity: normal
status: open
title: Imap from ThreadPool behaves unexpectedly
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue27585] asyncio.Lock deadlock after cancellation

2016-11-15 Thread Mathieu Sornay

Mathieu Sornay added the comment:

I might have found another pathological case not fixed by 
https://github.com/python/asyncio/pull/393

Tested in 3.6.0b3

The deadlock.py file prints :

DEADLOCK HERE
_locked:  False
_waiters: deque([])

--
nosy: +msornay
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file45489/deadlock.py

___
Python tracker 

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



[issue28699] Imap from ThreadPool behaves unexpectedly

2016-11-15 Thread Lev Veshnyakov

Changes by Lev Veshnyakov :


--
nosy: +davin

___
Python tracker 

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



[issue28668] instanciation of multiprocessing.Queue raises ImportError in test_logging

2016-11-15 Thread Xavier de Gaye

Changes by Xavier de Gaye :


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



[issue26929] android: test_strptime fails

2016-11-15 Thread Xavier de Gaye

Changes by Xavier de Gaye :


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



[issue27585] asyncio.Lock deadlock after cancellation

2016-11-15 Thread Guido van Rossum

Guido van Rossum added the comment:

Looks like create_waiter() entered the with-statement but didn't leave it
properly due to the cancellation, right? @1st1 any idea? async with bug or
asyncio bug?

--

___
Python tracker 

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



[issue28698] Python 3.x ctypes c_wchar_p return is different from official documentation example

2016-11-15 Thread Eryk Sun

Eryk Sun added the comment:

The repr can't automatically dereference the string at the address because it 
may be an invalid pointer. ctypes was developed on Windows, for which, in 
Python 2, it (ab)uses the obsolete IsBadStringPtr[A|W] function [1]. This 
function should never be used in a multithreaded process. 

On POSIX systems, the repr of c_char_p was special-cased to avoid dereferencing 
the pointer, but c_wchar_p was overlooked, and you can still easily crash 
Python 2 like this:

Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.c_wchar_p(1)
Segmentation fault (core dumped

A while back the bogus use of WinAPI IsBadStringPtr was removed from the Python 
3 branch, but apparently the docs weren't updated to reflect this change. I'm 
changing this to a documentation issue.

[1]: https://msdn.microsoft.com/en-us/library/aa366714

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, eryksun
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue28698] Python 3.x ctypes c_wchar_p return is different from official documentation example

2016-11-15 Thread Eryk Sun

Changes by Eryk Sun :


--
keywords: +easy
stage:  -> needs patch

___
Python tracker 

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



[issue28698] Python 3.x ctypes c_wchar_p return is different from official documentation example

2016-11-15 Thread Alex Wang

Alex Wang added the comment:

Hi Eryk,

Thanks a lot for quick reply~

This is about the bug I filed: http://bugs.python.org/issue28698#

I may still need your help to have a look the original case when I caught
this issue:

​I am writing some test automation which call C DLL from Python, the C
function is something like:

MEASURE_API int InitTester(char *ipAddress)

​So I need to pass an IP address string (for example, 192.168.100.100) from
Python in ctypes to this function. For non-const char in C, I used

c_ipAddress = create_string_buffer(b'192.168.100.100')
lib.InitTester(c_ipAddress)

​But error code returned indicate that the parameter passing is incorrect,
then I traced back and found then reported the c_char_p/c_wchar_p issue.​

Also tried
​c_ipAddress = create_unicode_buffer('192.168.100.100')
c_ipAddress = c_char_p(b'192.168.100.100')
c_ipAddress = c_wchar_p('192.168.100.100')​

​But none of them working... I had called other function to this C DLL
passing c_int(). c_bool(), c_void_p() and etc. they are all working as
expected, only string related have this issue.

Therefore, any idea how write the correct assignment and pass it to ​C DLL
for this case in Python 3.5? Any hint would be great helpful.

Thank you in advance~

BR,
Alex

On Tue, Nov 15, 2016 at 10:57 AM, Eryk Sun  wrote:

>
> Changes by Eryk Sun :
>
>
> --
> keywords: +easy
> stage:  -> needs patch
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue28700] test_dbm failure: KeyError: b'0' (regression in 3.6)

2016-11-15 Thread Greg Ward

New submission from Greg Ward:

test_dbm.py fails reliably for me in 3.6, but in 3.5 it passes ~80% of the 
time. The failure in both cases is KeyError: b'0', which has come up previously 
in http://bugs.python.org/issue20094 and http://bugs.python.org/issue14120.

But since we've switched from 20% failure rate to 100% failure rate, I figured 
something must have changed. I used "hg bisect" to track it down to a recent 
commit: 

changeset:   103360:0bd618fe0639
user:Victor Stinner 
date:Wed Sep 07 17:40:12 2016 -0700
summary: Implement compact dict

Here is how it fails:

$ ./python -m test -v test_dbm 
== CPython 3.6.0a4+ (default:0bd618fe0639, Nov 15 2016, 14:07:07) [GCC 5.4.0 
20160609]
==   Linux-4.4.0-47-generic-x86_64-with-debian-stretch-sid little-endian
==   hash algorithm: siphash24 64bit
==   /home/data/src/cpython/3.6/build/test_python_10093
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, 
verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_dbm
test_keys (test.test_dbm.WhichDBTestCase) ... ok
test_whichdb (test.test_dbm.WhichDBTestCase) ... ok
test_whichdb_ndbm (test.test_dbm.WhichDBTestCase) ... BDB0004 fop_read_meta: 
@test_10093_tmp_ndbm.db: unexpected file type or format
ok
test_anydbm_access (test.test_dbm.TestCase-dbm.ndbm) ... ok
test_anydbm_creation (test.test_dbm.TestCase-dbm.ndbm) ... ERROR
BDB3028 @test_10093_tmp.db: unable to flush: No such file or directory
test_anydbm_creation_n_file_exists_with_invalid_contents 
(test.test_dbm.TestCase-dbm.ndbm) ... ok
test_anydbm_keys (test.test_dbm.TestCase-dbm.ndbm) ... ok
test_anydbm_modification (test.test_dbm.TestCase-dbm.ndbm) ... ERROR
BDB3028 @test_10093_tmp.db: unable to flush: No such file or directory
test_anydbm_not_existing (test.test_dbm.TestCase-dbm.ndbm) ... ok
test_anydbm_read (test.test_dbm.TestCase-dbm.ndbm) ... ERROR
test_error (test.test_dbm.TestCase-dbm.ndbm) ... ok
test_anydbm_access (test.test_dbm.TestCase-dbm.dumb) ... ok
test_anydbm_creation (test.test_dbm.TestCase-dbm.dumb) ... ok
test_anydbm_creation_n_file_exists_with_invalid_contents 
(test.test_dbm.TestCase-dbm.dumb) ... ok
test_anydbm_keys (test.test_dbm.TestCase-dbm.dumb) ... ok
test_anydbm_modification (test.test_dbm.TestCase-dbm.dumb) ... ok
test_anydbm_not_existing (test.test_dbm.TestCase-dbm.dumb) ... ok
test_anydbm_read (test.test_dbm.TestCase-dbm.dumb) ... ok
test_error (test.test_dbm.TestCase-dbm.dumb) ... ok

==
ERROR: test_anydbm_creation (test.test_dbm.TestCase-dbm.ndbm)
--
Traceback (most recent call last):
  File "/home/data/src/cpython/3.6/Lib/test/test_dbm.py", line 73, in 
test_anydbm_creation
self.read_helper(f)
  File "/home/data/src/cpython/3.6/Lib/test/test_dbm.py", line 114, in 
read_helper
self.assertEqual(self._dict[key], f[key.encode("ascii")])
KeyError: b'0'

==
ERROR: test_anydbm_modification (test.test_dbm.TestCase-dbm.ndbm)
--
Traceback (most recent call last):
  File "/home/data/src/cpython/3.6/Lib/test/test_dbm.py", line 88, in 
test_anydbm_modification
self.read_helper(f)
  File "/home/data/src/cpython/3.6/Lib/test/test_dbm.py", line 114, in 
read_helper
self.assertEqual(self._dict[key], f[key.encode("ascii")])
KeyError: b'0'

==
ERROR: test_anydbm_read (test.test_dbm.TestCase-dbm.ndbm)
--
Traceback (most recent call last):
  File "/home/data/src/cpython/3.6/Lib/test/test_dbm.py", line 94, in 
test_anydbm_read
self.read_helper(f)
  File "/home/data/src/cpython/3.6/Lib/test/test_dbm.py", line 114, in 
read_helper
self.assertEqual(self._dict[key], f[key.encode("ascii")])
KeyError: b'0'

--
Ran 19 tests in 0.052s

FAILED (errors=3)
test test_dbm failed
test_dbm failed

1 test failed:
test_dbm

Total duration: 77 ms
Tests result: FAILURE

--
components: Tests
messages: 280877
nosy: gward
priority: normal
severity: normal
status: open
title: test_dbm failure: KeyError: b'0' (regression in 3.6)
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue28698] Python 3.x ctypes c_wchar_p return is different from official documentation example

2016-11-15 Thread Eryk Sun

Eryk Sun added the comment:

The issue tracker isn't a forum to answer general programming questions. Please 
ask this on python-list, and I'll try to help you there.

--

___
Python tracker 

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




[issue28700] test_dbm failure: KeyError: b'0' (regression in 3.6)

2016-11-15 Thread Greg Ward

Greg Ward added the comment:

Forgot to mention: I'm running:

No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 16.04.1 LTS
Release:16.04
Codename:   xenial

with

$ dpkg-query -W | grep dbm
libgdbm3:amd64  1.8.3-13.1

--

___
Python tracker 

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



[issue28700] test_dbm failure: KeyError: b'0' (regression in 3.6)

2016-11-15 Thread Greg Ward

Greg Ward added the comment:

As suggested in http://bugs.python.org/issue14120, I installed libgdbm-dev, 
re-configured, and re-compiled. That fixes the problem.

IMHO that's not good enough: if we're missing a dependency, then either 
configuring or building should fail. It's nice that the test failure is now 
rock-solid reliable rather than intermittent, but it's still a test failure due 
to missing dependency. Yuck.

--

___
Python tracker 

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



[issue28700] test_dbm failure: KeyError: b'0' (intermittent in 3.5, reliable in 3.6)

2016-11-15 Thread Greg Ward

Changes by Greg Ward :


--
title: test_dbm failure: KeyError: b'0' (regression in 3.6) -> test_dbm 
failure: KeyError: b'0' (intermittent in 3.5, reliable in 3.6)

___
Python tracker 

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



[issue28670] PEP 235: Implement on every POSIX system, and clean up the C code for `import'

2016-11-15 Thread Brett Cannon

Brett Cannon added the comment:

So there's no "promised behavior" that's missing in Python 2.7. If you read PEP 
235 it's very clear what platforms it was meant for: cygwin, macOS, and 
Windows. There's no promise of supporting PYTHONCASEOK for POSIX in general so 
it isn't as if the PEP is not fully implemented. And even if it was promised, 
this is a potential breaking change as the semantics of Python 2.7 would shift 
in a rather key way on certain platforms based on the external factor of 
PYTHONCASEOK simply being set which someone may have carelessly done. In other 
words while you view this as a fix for breakage on a platform, I view it as 
adding support for a certain platform configuration on POSIX which is a new 
feature.

Since you said this doesn't affect Python 3, I'm closing this as rejected. I 
appreciate the attempt at a patch, but this is considered a new feature for 
Python 2.7 which is not open to new features.

In case you choose to submit other patches in the future I'll address your 
other comments you left about how to test and our development workflow.

To test this what you would basically need to do is detect when the test suite 
was run on a platform that was case-preserving but case-insensitive and then on 
such a platform make sure imports worked as expected with and without 
PYTHONCASEOK set (see the tests that already do this on macOS and Windows).

As for your patchset, I understand your intention, but Python's workflow simply 
doesn't work the way you want it to. The commit messages that go into version 
control are set by core developers on purpose to make sure they are formatted 
as expected and contain the appropriate information. For instance, while your 
commit messages are very detailed, we tend to askew long commit messages and go 
for succinct messages that explain the "why" something was done (a paragraph of 
explanation is itself rare). Your commit messages were also not formatted 
correctly, e.g. we always list the relevant issue that motivated a change first 
like "Issue #28670: ...". And lastly, we want commits to represent a single 
unit of semantic change when possible, so if your work made sense to break up 
into multiple patches then we would need to open multiple issues for each 
semantic change to be discussed in isolation and on their own merits. It also 
makes tracking what semantic changes broke something easier when
  running a bisection on commits to find the change that broke something (and 
thus easier to also back out instead of searching for every related commit 
because it spanned more than one).

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

___
Python tracker 

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



[issue28701] Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString

2016-11-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch replaces calls of public function 
PyUnicode_CompareWithASCIIString() with new private function 
_PyUnicode_EqualToASCIIString(). The problem with  
PyUnicode_CompareWithASCIIString() is that it returns -1 for the result "less 
than" and error, but the error case is never checked. The patch is purposed for 
following purposes:

1. Readability. ``_PyUnicode_EqualToASCIIString(...)`` looks more readable than 
``PyUnicode_CompareWithASCIIString(...) == 0`` or 
``!PyUnicode_CompareWithASCIIString(...)``, especially in large expression. I 
always have to make an effort to understand correctly the meaning of the latter 
expression.

2. Efficiency. If the strings are not equal, _PyUnicode_EqualToASCIIString() 
can quickly return false, but PyUnicode_CompareWithASCIIString() needs to check 
whether what string is larger.

3. Correctness. Since no caller checks the error of 
PyUnicode_CompareWithASCIIString(), it is incorrectly interpreted as "less 
then". Exception set by PyUnicode_CompareWithASCIIString() can be leaked in 
following code causing mystical error or crash in debug build. There are too 
many callers to add error checking for them all. These would be non-trivial 
error-prone changes that add new lines of the code, new variables and new 
returns or gotos. On other hand replacing PyUnicode_CompareWithASCIIString() 
with _PyUnicode_EqualToASCIIString() is done by simple script.

_PyUnicode_EqualToASCIIString() returns true value (1) if strings are equal, 
false value (0) if they are different, and doesn't raise exceptions. Unlike to 
PyUnicode_CompareWithASCIIString() it works only with ASCII characters and 
returns false if any string contains non-ASCII characters.

The patch also documents the return value of PyUnicode_CompareWithASCIIString() 
in case of error.

See issue21449 for similar issue with _PyUnicode_CompareWithId().

--
components: Interpreter Core, Unicode
files: _PyUnicode_EqualToASCIIString.patch
keywords: patch
messages: 280882
nosy: ezio.melotti, haypo, josh.r, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: Replace PyUnicode_CompareWithASCIIString with 
_PyUnicode_EqualToASCIIString
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45490/_PyUnicode_EqualToASCIIString.patch

___
Python tracker 

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



[issue28701] Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString

2016-11-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: 
http://bugs.python.org/file45491/PyUnicode_CompareWithASCIIString.cocci

___
Python tracker 

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



[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2016-11-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

_PyUnicode_EqualToASCIIString() added in issue28701 would help in the patch for 
this issue.

--
dependencies: +Replace PyUnicode_CompareWithASCIIString with 
_PyUnicode_EqualToASCIIString

___
Python tracker 

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



[issue28698] Python 3.x ctypes c_wchar_p return is different from official documentation example

2016-11-15 Thread Eryk Sun

Changes by Eryk Sun :


--
Removed message: http://bugs.python.org/msg280878

___
Python tracker 

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



[issue28702] Confusing error message when None used in expressions, eg. "'NoneType' object has no attribute 'foo'"

2016-11-15 Thread Greg Ward

New submission from Greg Ward:

Python's error message when you let None accidentally sneak into an expression 
where it doesn't belong could be better. The canonical example is attribute 
lookup:

>>> a = None
>>> a.foo
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'NoneType' object has no attribute 'foo'

This assumes that the programmer knows there is only one object of type 
NoneType, and it is None. That's a lot to assume of a beginner, whether they 
are coming from another programming language ("null has a type? that's crazy 
talk!") or are completely new to programming ("null? none? nil? wat...??").

There are plenty of other places this use of NoneType in error messages comes 
up:

>>> a + 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
>>> 1 + a
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
>>> len(a)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: object of type 'NoneType' has no len()
>>> a < 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: '<' not supported between instances of 'NoneType' and 'int'

I think we can do better than this. For example, here is an proposed 
improvement to user experience for getting and setting attributes on None:

>>> a.foo
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attempt to access attribute 'foo' of None, but None has no 
attributes
>>> a.foo = 42
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attempt to set attribute 'foo' on None, but None is read-only

Let the bikeshedding commence. I have a working patch, but need to write tests. 
Will upload it here when that is done.

--
assignee: gward
components: Interpreter Core
messages: 280884
nosy: gward
priority: normal
severity: normal
status: open
title: Confusing error message when None used in expressions, eg. "'NoneType' 
object has no attribute 'foo'"
type: enhancement
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



[issue28702] Confusing error message when None used in expressions, eg. "'NoneType' object has no attribute 'foo'"

2016-11-15 Thread Greg Ward

Greg Ward added the comment:

Based on a brief conversation with Brett Cannon at PyCon Canada the other day. 
Thanks for the idea, Brett!

--
nosy: +brett.cannon

___
Python tracker 

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



[issue28703] Fix asyncio.iscoroutinefunction to handle Mock objects

2016-11-15 Thread Yury Selivanov

Changes by Yury Selivanov :


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



[issue28703] Fix asyncio.iscoroutinefunction to handle Mock objects

2016-11-15 Thread Yury Selivanov

New submission from Yury Selivanov:

Proxy for https://github.com/python/asyncio/pull/459

--
assignee: yselivanov
components: asyncio
messages: 280886
nosy: gvanrossum, yselivanov
priority: normal
severity: normal
stage: resolved
status: open
title: Fix asyncio.iscoroutinefunction to handle Mock objects
type: behavior
versions: 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



[issue28703] Fix asyncio.iscoroutinefunction to handle Mock objects

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 179e556a50ce by Yury Selivanov in branch '3.5':
Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects.
https://hg.python.org/cpython/rev/179e556a50ce

New changeset 4d78290b1d8e by Yury Selivanov in branch '3.6':
Merge 3.5 (issue #28703)
https://hg.python.org/cpython/rev/4d78290b1d8e

New changeset 298c53e2461f by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28703)
https://hg.python.org/cpython/rev/298c53e2461f

--
nosy: +python-dev

___
Python tracker 

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



[issue28704] Fix create_unix_server to support Path-like objects (PEP 519)

2016-11-15 Thread Yury Selivanov

Changes by Yury Selivanov :


--
assignee: yselivanov
components: asyncio
nosy: gvanrossum, yselivanov
priority: normal
severity: normal
stage: resolved
status: open
title: Fix create_unix_server to support Path-like objects (PEP 519)
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue28700] test_dbm failure: KeyError: b'0' (intermittent in 3.5, reliable in 3.6)

2016-11-15 Thread Martin Panter

Martin Panter added the comment:

Is the problem something like a missing C function prototype? Maybe you see 
compiler warnings, but the compiler and linker carry on with the wrong 
prototype. If you build with “make -s”, warnings might be easier to see.

If my guess is right, this would be similar to Issue 27659, where a module half 
builds with warnings about a missing crypt() function prototype, although it 
later fails when linking. Maybe more configure or setup.py checks? (I’m not a 
fan of configure, but it often seems the easiest short-term solution.)

--
nosy: +martin.panter

___
Python tracker 

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



[issue28704] Fix create_unix_server to support Path-like objects (PEP 519)

2016-11-15 Thread Yury Selivanov

New submission from Yury Selivanov:

Proxy for https://github.com/python/asyncio/pull/462

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



[issue28704] Fix create_unix_server to support Path-like objects (PEP 519)

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f8207c98eb5e by Yury Selivanov in branch '3.5':
Issue #28704: Fix create_unix_server to support Path-like objects
https://hg.python.org/cpython/rev/f8207c98eb5e

New changeset 0d663f758adb by Yury Selivanov in branch '3.6':
Merge 3.5 (issue #28704)
https://hg.python.org/cpython/rev/0d663f758adb

New changeset c7d2ec49a80b by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28704)
https://hg.python.org/cpython/rev/c7d2ec49a80b

--
nosy: +python-dev

___
Python tracker 

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



[issue28702] Confusing error message when None used in expressions, eg. "'NoneType' object has no attribute 'foo'"

2016-11-15 Thread R. David Murray

R. David Murray added the comment:

That presumably means adding special None support to all the places None can 
appear in a message, where now the code treats None like it does every other 
object.  I'm not sure the added complexity is worth it, especially since 
NoneType would still creep in anywhere we'd forgotten to "fix".  I'm not voting 
-1, but I'm dubious.

Maybe we should just make NoneType's name be 'None' :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue28702] Confusing error message when None used in expressions, eg. "'NoneType' object has no attribute 'foo'"

2016-11-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Approximate counts.

C code:
ob_type->tp_name161
Py_TYPE(...)->tp_name   285

Python code:
__class__.__name__  224
__class__.__qualname__   23
type(...).__name__  112
type(...).__qualname__5

Is it worth changing about 800 places in CPython code? Not counting third-party 
code.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28706] msvc9compiler does not find a vcvarsall.bat of Visual C++ for Python 9.0

2016-11-15 Thread Jiří Hofman

New submission from Jiří Hofman:

When running
"c:\Program Files\Python27\Scripts\pip2.7.exe" install wx
following error occurs:

Complete output from command "c:\program files\python27\python.exe" -u -c 
"import setuptools, 
tokenize;__file__='c:\\users\\jiri\\appdata\\local\\temp\\pip-build-lqokio\\wx\\setup.py';f=getattr(tokenize,
 'open', open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
c:\users\jiri\appdata\local\temp\pip-51m45m-record\install-record.txt 
--single-version-externally-managed --compile:
running install
running build
WARNING: Building this way assumes that all generated files have been
generated already.  If that is not the case then use build.py directly
to generate the source and perform the build stage.  You can use
--skip-build with the bdist_* or install commands to avoid this
message and the wxWidgets and Phoenix build steps in the future.

"c:\program files\python27\python.exe" -u build.py build
Will build using: "c:\program files\python27\python.exe"
2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit 
(AMD64)]
Python's architecture is 64bit
cfg.VERSION: 3.0.3

Running command: build
Running command: build_wx
Command '"c:\program files\python27\python.exe" -c "import 
distutils.msvc9compiler as msvc; mc = msvc.MSVCCompiler(); mc.initialize(); 
print(mc.cc)"' failed with exit code 1.
Traceback (most recent call last):
  File "", line 1, in 
  File "c:\program files\python27\lib\distutils\msvc9compiler.py", line 
385, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
  File "c:\program files\python27\lib\distutils\msvc9compiler.py", line 
273, in query_vcvarsall
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat
Finished command: build_wx (0.138s)
Finished command: build (0.139s)
Command '"c:\program files\python27\python.exe" -u build.py build' failed 
with exit code 1.

I found out that the problem is in msvc9compiler. The dir where vcvarsall.bat 
is installed is not found. It is installed (by default) in 
C:\Users\Jiri\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0
Needed registry keys do not exist after installation of the Visual C++ for 
Python 9.0.

My OS is Windows 10 Home (64bit).

--
components: Distutils
messages: 280894
nosy: dstufft, eric.araujo, jyrkih
priority: normal
severity: normal
status: open
title: msvc9compiler does not find a vcvarsall.bat of Visual C++ for Python 9.0
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



[issue28670] PEP 235: Implement on every POSIX system, and clean up the C code for `import'

2016-11-15 Thread Michael Witten

Michael Witten added the comment:

Guess what?

Linux can access HFS+ and NTFS volumes.

Firstly, how does that fit into your ideas for testing? It doesn't;
however, you'll note that my own brief analysis did attempt to wrestle
with this nuance.

Secondly, it was (and is) clearly asinine to conflate an operating
system with a particular file system; PEP 235 betrays the naive
ways of ancient thinkers---the spirit of the text of PEP 235
has never been completely implemented, and the result of this
naivete is a broken userspace *today*.

Here are the cases for my patch:

  * Non-POSIX platforms: Nothing changes.

  * POSIX platforms:

  * PYTHONCASEOK set:Nothing changes.

  * PYTHONCASEOK not set:Almost nothing changes.
 ---
 Accessing an insane file
 system now works just like
 on a Non-POSIX platform. In
 most cases, this won't change
 anything; yet, rare cases
 will *now* Just Work, rather
 than crapping out with some
 inscrutable error.

Where is your qualm?

As for the organization of patches, what I have presented (and
especially what I describe for a merge commit) not only meets
your stated goals, but *exceeds* them in every way.

Nevertheless, I would be willing to dumb down my submission if
it meant getting this bug fixed.

--

It's rude to close abruptly an issue without even the implicit
consent of your collocutor, especially when the reasoning for
such an action is, once again, based explicitly on a startling
degree of willful ignorance and maybe even technical incompetence.

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

___
Python tracker 

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



[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-15 Thread Michael Hu

Michael Hu added the comment:

Core is uploaded for python 2.7.10 to assist debugging.

--
Added file: http://bugs.python.org/file45492/core_python2.7.10.gz

___
Python tracker 

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



[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Try to get the Python traceback of thread on the crash: try the faulthandler 
module.

--
nosy: +haypo

___
Python tracker 

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



[issue28707] add 'directory' option to the http.server module

2016-11-15 Thread Stéphane Wirtel

New submission from Stéphane Wirtel:

When we execute the http.server module, the tool will use the current directory 
(os.getcwd()) but sometimes we would like to specify a directory on the command 
line. 

With the next patch, I try to fix this missing feature ;-)

Just with python -m http.server -d /tmp

by default the system will use the current directory.
if necessary, I will show an error if the directory does not exist.

--
files: chdir-httpserver.diff
keywords: patch
messages: 280898
nosy: matrixise
priority: normal
severity: normal
status: open
title: add 'directory' option to the http.server module
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45493/chdir-httpserver.diff

___
Python tracker 

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



[issue28707] add 'directory' option to the http.server module

2016-11-15 Thread Stéphane Wirtel

Changes by Stéphane Wirtel :


--
nosy: +haypo

___
Python tracker 

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



[issue28707] add 'directory' option to the http.server module

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

The new feature should be documented in Doc/library/http.server.rst, and maybe 
also Doc/whatsnew/3.7.rst.

Is it possible to write an unit test?

--

___
Python tracker 

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



[issue28708] Low FD_SETSIZE limit on Windows

2016-11-15 Thread David Hirschfeld

New submission from David Hirschfeld:

Back in 1999 the compile-time constant FD_SETSIZE was raised from (the default 
on Windows) 64 to 512 open sockets to support *serious async servers*

http://bugs.python.org/issue210843
https://github.com/python/cpython/blame/master/Modules/selectmodule.c#L29-L36

The world has moved on and serious async servers require far more than 512 
sockets available. This is one of the key reasons why tornado explicitly states:

> Tornado will also run on Windows, although this configuration is not 
> officially supported and is recommended only for development use.

Yes, using select on Windows is the wrong thing to do, but it's far preferable 
to be able to use a library which makes use of select, putting up with the poor 
performance than it is to be told to use linux which often isn't an option.

Since there's no alternative other than recompiling Python it would be good if 
this constant could be increased to a more useful (these days) value of say 
16384.

As a data point ZMQ have recently increased the value of this constant to 16k 
themselves

https://github.com/zeromq/libzmq/pull/2035

--
messages: 280900
nosy: David Hirschfeld
priority: normal
severity: normal
status: open
title: Low FD_SETSIZE limit on Windows
type: resource usage
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue28708] Low FD_SETSIZE limit on Windows

2016-11-15 Thread Zachary Ware

Changes by Zachary Ware :


--
components: +Build, 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



[issue28708] Low FD_SETSIZE limit on Windows

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

To implement an efficient event loop, IOCP is the way to do: the asyncio module 
supports it using ProactorEventLoop.

--
nosy: +haypo

___
Python tracker 

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



[issue28708] Low FD_SETSIZE limit on Windows

2016-11-15 Thread Steve Dower

Steve Dower added the comment:

It looks like Modules/selectmodule.c already has the handling for when this 
gets large (and we really want to stop allocating the static array on the 
stack), which is a plus, but I'd want to see the performance cost to small 
selects if suddenly we're allocating 100s of KB on the heap rather than small 
and cheap stack allocations.

For the amount of work going on here for each select() call, Victor is right - 
you're going to get severely diminishing returns as this increases in size.

However, I see no reason why this couldn't be totally dynamic, at least on 
Windows. Redefining that value just changes a static array definition, but the 
array size never gets passed in to the OS AFAICT, so there's no reason we 
couldn't stack allocate for small select()s and heap allocate for big 
select()s. That's considerably more work than anyone had in mind, I'd wager.

--

___
Python tracker 

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



[issue28707] add 'directory' option to the http.server module

2016-11-15 Thread Julien Palard

Julien Palard added the comment:

Hi Stéphane,

Your patch is simple and elegant, but I'm asking myself a question about the 
idea to pass a class instead of an instance to the TCPServer ctor (I know 
that's not your choice).

If we were able to pass an instance of SimpleHTTPRequestHandler instead of its 
class, we'd be able to give the `directory` to the handler during the `main()`, 
instead of using with `chdir` and `getcwd` to pass the information in a kind of 
hidden/side channel.

I think that relying on `chdir` and `getcwd` to pass a parameter is not the 
most pretty or most testable way to do so. Also, having an `os.getcwd()` 
hardcoded in `SimpleHTTPRequestHandler` does not looks right (again, not your 
fault, it was here before…) typically for testability, but also when used in a 
concurrent environment, when cwd may be changed by other "coroutines".

I tried to provide a patch fixing all those condiderations, here it is. still, 
I can't write a patch as KISS as yours, so I'm probably in the wrong way, at 
least I tried.

--
nosy: +mdk
Added file: http://bugs.python.org/file45494/28707.patch

___
Python tracker 

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



[issue28709] PyStructSequence_NewType is broken

2016-11-15 Thread Josh Rosenberg

Changes by Josh Rosenberg :


Added file: http://bugs.python.org/file45496/setup.py

___
Python tracker 

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



[issue28709] PyStructSequence_NewType is broken

2016-11-15 Thread Josh Rosenberg

New submission from Josh Rosenberg:

I could be missing something, but it looks like PyStructSequence_NewType is 
guaranteed broken. Specifically, it allocates the memory with 
PyType_GenericAlloc (use PyType_Type as the base), and PyType declares itself 
to have garbage collected instances, so the memory is allocated with 
_PyObject_GC_Malloc and added to GC tracking just before PyType_GenericAlloc 
returns.

Problem is, PyStructSequence_Init2 copies from a template struct which sets 
Py_TPFLAGS_DEFAULT. So even though the new struct sequence is GC allocated and 
managed, it doesn't set Py_TPFLAGS_HEAPTYPE, which means when GC tries to 
traverse it, type's type_traverse errors out with:

Fatal Python error: type_traverse() called for non-heap type 
'NameOfStructSequence'

It's possible I'm missing something here, so I've attached simple test code for 
others to confirm (it omits most error checking for simplicity/readability).

Just compile the extension module, then run (with the module in the working 
directory):

python -c "import testnewtype; Foo = testnewtype.makeseq('Foo', ['x', 'y'])"

There is a commented out line in the test code that explicitly sets the 
HEAPTYPE flag after type construction (no idea if that's supposed to be 
supported), and uncommenting it seems to fix the crash (though again, if 
retroactively flagging as HEAPTYPE is unsupported, something else may break 
here).

I can't find any actual use of PyStructSequence_NewType in the CPython code 
base, which probably explains why this hasn't been seen; odds are, most 
extensions using struct sequences are using Init, not NewType, and I only ran 
into this because I was experimenting with a struct sequence based replacement 
for collections.namedtuple (to end the start up time objections to using 
namedtuple in the built-in modules, e.g. #28638).

--
components: Interpreter Core
files: testnewtype.c
messages: 280904
nosy: josh.r
priority: normal
severity: normal
status: open
title: PyStructSequence_NewType is broken
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45495/testnewtype.c

___
Python tracker 

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



[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg

Changes by Josh Rosenberg :


--
title: PyStructSequence_NewType is broken -> PyStructSequence_NewType is 
broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

___
Python tracker 

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



[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Note: Uncommenting the line that forces Py_TPFLAGS_HEAPTYPE isn't enough, since 
it looks like the PyHeapTypeObject fields aren't initialized properly, causing 
seg faults if you access, for example, __name__/__qualname__ (or print the 
type's repr, which implicitly accesses same):

python -c "import testnewtype; Foo = testnewtype.makeseq('Foo', ['x', 
'y']); print(Foo.__name__)"

The type behaves properly otherwise (you can make instances, access values on 
them), but crashing on repr is probably poor form. :-)

--

___
Python tracker 

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



[issue28707] add 'directory' option to the http.server module

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Julien Palard added the comment:
> If we were able to pass an instance of SimpleHTTPRequestHandler instead of 
> its class, we'd be able to give the `directory` to the handler during the 
> `main()`, instead of using with `chdir` and `getcwd` to pass the information 
> in a kind of hidden/side channel.

You may be able to use functools.partial() to pass an additional
parameter to the request handler constructor.

We use something like that in asyncio for protocols.

--

___
Python tracker 

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



[issue28710] Sphinx incompatible markup in configparser.ConfigParser.

2016-11-15 Thread Patrick Lehmann

New submission from Patrick Lehmann:

Why does e.g. configparser.ConfigParser contain doc strings with Sphinx 
incompatible markup?

The markup starts with back-tick, but ends with a single quote.

Example:
https://github.com/python/cpython/blob/master/Lib/configparser.py?ts=2#L26

Sphinx writes these messages:
D:\git\PoC\py\lib\ExtendedConfigParser\__init__.py:docstring of 
lib.ExtendedConfigParser.ExtendedConfigParser.read_file:3: WARNING: Inline 
interpreted text or phrase reference start-str
ing without end-string.

Note: ExtendedConfigParser is class derived from configparser.ConfigParser. 
Inherited methods get documented too.


Btw. I have some improvements for this class, how can I contribute them? Who is 
the maintainer for this class? Please contact me: patrick.lehm...@tu-dresden.de

The improved version is available at GitHub: 
https://github.com/Paebbels/ExtendedConfigParser?ts=2

--
assignee: docs@python
components: Documentation
messages: 280907
nosy: Patrick Lehmann, docs@python
priority: normal
severity: normal
status: open
title: Sphinx incompatible markup in configparser.ConfigParser.
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg

Josh Rosenberg added the comment:

On further checking, looks like there is a lot of work that should be done to 
initialize heap types (see PyType_FromSpecWithBases) that 
PyStructSequeuence_Init2 doesn't do (because it thinks it's working on a static 
type). I think the solution here is decouple PyStructSequeuence_NewType from 
PyStructSequeuence_Init2 (or to minimize code duplication, make both of them 
call a third internal function that accepts additional flags, e.g. to make the 
type a HEAPTYPE, BASETYPE, or both, and performs the additional work required 
for those flags if given); Init2 clearly expects a static type, and 
definitionally, NewType is producing a heap/dynamic type.

--

___
Python tracker 

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



[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-15 Thread Michael Hu

Michael Hu added the comment:

(gdb) py-bt
#4 Frame 0x7f0ab7a2db60, for file 
/etc/remoting/remoting_agent.zip/Pyro4/socketutil.py, line 463, in close 
(self=)
self.sock.shutdown(socket.SHUT_RDWR)
#7 Frame 0x7f0ab0001760, for file 
/etc/remoting/remoting_agent.zip/Pyro4/socketutil.py, line 453, in __del__ 
(self=)
self.close()
(gdb) py-list
 458def recv(self, size):
 459return receiveData(self.sock, size)
 460
 461def close(self):
 462try:
>463self.sock.shutdown(socket.SHUT_RDWR)
 464except (OSError, socket.error):
 465pass
 466try:
 467self.sock.close()
 468except AttributeError:
(gdb) f 7
#7  PyEval_EvalFrameEx (
f=f@entry=Frame 0x7f0ab0001760, for file 
/etc/remoting/remoting_agent.zip/Pyro4/socketutil.py, line 453, in __del__ 
(self=), 
throwflag=throwflag@entry=0) at ../Python/ceval.c:2681
2681in ../Python/ceval.c
(gdb) py-list
 448def __init__(self, sock, objectId=None):
 449self.sock = sock
 450self.objectId = objectId
 451
 452def __del__(self):
>453self.close()
 454
 455def send(self, data):
 456sendData(self.sock, data)
 457
 458def recv(self, size):
(gdb)

--

___
Python tracker 

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



[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg

Changes by Josh Rosenberg :


--
type:  -> crash

___
Python tracker 

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



  1   2   >