[issue28673] pyro4 with more than 15 threads often crashes 2.7.12

2016-11-26 Thread INADA Naoki

INADA Naoki added the comment:

> Where *exactly*?

See attached patch.
But python with this patch can deadlock in other state. Main thread wait GIL
but no other living threads have GIL. It seems caused by other issue around 
finalization and multithreading.

> Py_FinalizeEx() first calls wait_for_thread_shutdown() and *then* sets 
> _Py_Finalizing to tstate.
> Does wait_for_thread_shutdown() complete on this bug?

Yes. wait_for_thread_shutdown() waits only daemon threads.
After _Py_Finalizing = tstate, main thread calls many __del__ methods
while shutdown. If one of them starts new thread, this deadlock happens.

--
keywords: +patch
Added file: http://bugs.python.org/file45659/28673-fix-deadlock.patch

___
Python tracker 

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



[issue28739] PEP 498: docstrings as f-strings

2016-11-26 Thread Guido van Rossum

Guido van Rossum added the comment:

I was just noticing that the formal grammar in the reference manual first
defines a single string literal and then separately describes concatenation.

--

___
Python tracker 

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



[issue24142] ConfigParser._read doesn't join multi-line values collected while reading if a ParsingError occured

2016-11-26 Thread Ned Deily

Ned Deily added the comment:

After discussing this offline with Łukasz, I'm going to take the risk of 
allowing the non-conforming 3.6 checkin to remain in for 3.6.0.

--
nosy: +ned.deily

___
Python tracker 

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



[issue28739] PEP 498: docstrings as f-strings

2016-11-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I considered concatenated string literals to be included in 'string literal'.  
If that is not obvious, then it should be made so.  Replace 'string literal' 
with 'string literal or concatenated strings literals' and link each part to 
their respective (and successive) sections.

--

___
Python tracker 

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



[issue28775] Option to set startup directory in IDLE

2016-11-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Raymond: yes, I am definitely open to collaboration on this issue.  The timing 
is good as I just started, a month ago, expanding configure dialog testing 
beyond the trivial one of creating an instance without raising.  Real tests are 
needed preparation for making other changes, including adding other new options 
in 3.6+.  I would like to include this one in 3.6.1, 4 to 6 months from now.

Doing so may require more information about IDLE on *nix and Mac than I 
currently have.  Which of those have you run IDLE on?  Or helped people with in 
your classes?

Nofar: welcome.  I have two immediate questions.  1) Which OS do you primarily 
work with?  (I am using Win 10.)  Can you test on anything else?  2) Are you 
only interested in this issue, or might you be open to working on other issues 
if this one is successful?

Idlelib is not an easy codebase to get into.  The +-60 modules are listed in 
README.txt.  There is also a mapping from menu items to implementation code.  
However, the README does not cover the addition of a new option.  I will write 
and upload a design document or roadmap for this one.

--
stage:  -> test needed
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



[issue28804] file tell() report incorrect file position on Windows (but Linux is OK)

2016-11-26 Thread Eric V. Smith

Eric V. Smith added the comment:

Yes, it's a duplicate.

The only valid operation on the value of calling tell() from a text-mode file 
is to pass it to seek(). As long as that works, there's no bug here.

--
nosy: +eric.smith
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> io.TextIOWrapper.tell() report 65bit number when mix readline() 
+ tell()

___
Python tracker 

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



[issue28494] is_zipfile false positives

2016-11-26 Thread Thomas Waldmann

Thomas Waldmann added the comment:

Well, if you have a better idea how to fix is_zipfile, go on.

I even suggested an alternative, how about that?

It is a miserable state when the is_zipfile function in the stdlib detects 
random crap as a zip file.

--

___
Python tracker 

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



[issue24142] ConfigParser._read doesn't join multi-line values collected while reading if a ParsingError occured

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is this release critical for 3.6.0?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue24142] ConfigParser._read doesn't join multi-line values collected while reading if a ParsingError occured

2016-11-26 Thread Łukasz Langa

Łukasz Langa added the comment:

Thanks for your patch! As you can see, 2.7 is no longer touched as the 
codebases diverged. I'll release a 3.6 backport on PyPI sometime this weekend 
that you can use.

--
resolution:  -> fixed
status: open -> closed
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 2.7

___
Python tracker 

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



[issue24142] ConfigParser._read doesn't join multi-line values collected while reading if a ParsingError occured

2016-11-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 40567b8e3478 by Łukasz Langa in branch '3.5':
Fixes #24142: [configparser] always join multiline values to not leave the 
parser in an invalid state
https://hg.python.org/cpython/rev/40567b8e3478

New changeset 306cfb866399 by Łukasz Langa in branch '3.6':
Merge 3.5, fix for #24142
https://hg.python.org/cpython/rev/306cfb866399

New changeset 876bee0bd0ba by Łukasz Langa in branch 'default':
Merge 3.6, fix for #24142
https://hg.python.org/cpython/rev/876bee0bd0ba

--
nosy: +python-dev

___
Python tracker 

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



[issue28739] PEP 498: docstrings as f-strings

2016-11-26 Thread Guido van Rossum

Guido van Rossum added the comment:

I think such a patch is fine -- for 3.6.1.

Also note that linking to the definition of "string literal" is
insufficient, assuming we will want to continue supporting literal
concatenation (
https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation).
(And I want to, because I can see a use case.)

--

___
Python tracker 

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



[issue28739] PEP 498: docstrings as f-strings

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch makes f-strings not be accepted as docstrings. It also disallow 
f-strings in ast.literal_eval().

--
keywords: +patch
Added file: http://bugs.python.org/file45658/fstring-no-docstring.patch

___
Python tracker 

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



[issue28739] PEP 498: docstrings as f-strings

2016-11-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I withdraw my previously suggested addition to the Docstring glossary entry 
(msg281740).  It implies that trivial f-strings are acceptable and I agree that 
other implementations and future Cpython should be free to strictly follow the 
literal meaning of the first sentence: docstring = initial string literal 
expression.

I suggest instead that 'string literal' in the first sentence link to 
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals.
  This would make it clearer that 'string literal' is being used the the Python 
technical sense rather than in any more informal English sense.

We could possibly add a version of what Guido said above, such as: "(Acceptance 
of anything other than a string literal as a docstring is an implementation 
accident and should not be relied upon.)"

--

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think only the mention in What's News is needed. Elvis already provided a 
patch in issue28635.

But the documentation of other opcodes may be missed or outdated.

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Thanks Elvis!

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-26 Thread Elvis Pranskevichus

Elvis Pranskevichus added the comment:

Here's a patch to add opcode changes to the What's New document.  Thanks for 
pointing this out Serhiy.

--
Added file: 
http://bugs.python.org/file45657/0001-Issue-28635-Document-Python-3.6-opcode-changes.patch

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2016-11-26 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

SETUP_ANNOTATIONS and STORE_ANNOTATION opcodes are documented in documentation 
for dis module. Should they be documented also somewhere else?

--
nosy: +levkivskyi

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2016-11-26 Thread Bert JW Regeer

Bert JW Regeer added the comment:

Unfortunately I need to spin another patch, the one I created didn't solve the 
issue for one of WebOb's users:

https://github.com/Pylons/webob/pull/300 (Thanks Julien Meyer!)

I have his permission to grab his test/patch and update this patch, I will get 
this done later today.

That being said, this is a real issue, and WebOb will be shipping a fix for 
Python less than 3.6 anyway, so whether this gets released in 3.6 or not 
doesn't matter to me. I'd prefer this to be fixed in the standard library for 
all users, rather than just for WebOb users.

Even if this were released for 3.6.1, WebOb will have to carry the fix for the 
foreseeable future.

--

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2016-11-26 Thread Ned Deily

Ned Deily added the comment:

Berker asks in IRC whether this change should go into 3.6.0 (at rc1).  While it 
is affecting a relatively self-contained part of the standard library (cgi), 
the issue doesn't seem to be "release critical".  Further, it is changing 
behavior that was changed barely a year ago for Issue24764.  My preference 
would be to try to have this change reviewed and/or tested by at least some of 
the people involved with the earlier issue and, if there is a consensus for it, 
target the change for 3.6.1.

--
nosy: +ned.deily

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I would suggest to use sys.maxsize for default value in Argument Clinic, but 
right now bisect functions don't support well hi > len(a). This needs adding an 
equivalent of hi = min(hi, len(a)) in C code.

-1 could be explicitly supported for backward compatibility. But it could be 
deprecated.

--

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

[SS]
> This is rather a random difference. Try to run the bench several times.

I did run several times.  The results were perfectly stable (+/- 1ns).  It 
tells us that METH_FASTCALL is something we want to use as broadly as possible.


[JP]
> it yielded a consistent 18% improvement on bisect.bisect("abcdef", "c")
> on two different machines.

Thanks for running timings.  When you do timing in the future, try to select 
timings that are indicative of actual use.  No one uses bisect to search 
strings for a character -- the typical use case is searching a list of range 
breakpoints like the example shown in the docs:

def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):
i = bisect(breakpoints, score)
return grades[i]

Hash tables are faster for exact lookup.  Bisect is mainly used for searching 
ranges (i.e. tax brackets or position in a cumulative distribution).

[VS]
> Speedup for tiny lists is just a nice side effect.

To you perhaps; however, the entire reason I put this code in many years ago 
was for performance.  The existing pure python code was already very fast.  
Anyway, this patch is a nice improvement in that regard.

[Everyone]

What to do about the "hi" argument is a sticky point.  This is a long-standing 
API, so any API changes would likely break some code or lock us into exposing 
unintuitive implementation details (like hi=-1).

The point of view of the existing C code, the pure Python version, and the docs 
is that the "hi" argument is an optional argument that when omitted will 
default to "len(a)".  It was not intended that a user would explicitly pass in 
"hi=None" as allowed by the pure python version but not by the C version, nor 
was it intended to have the user pass in "hi=-1" as allowed by the C version 
but causes incorrect behavior on the pure Python version.

It is unfortunate that the argument clinic has not yet grown support for the 
concept of "there is special meaning for an omitted argument that cannot be 
simulated by passing in a particular default value".  I believe when this issue 
has arisen elsewhere, the decision was to skip applying argument clinic at all. 
 See:  builtin_getattr, builtin_next, dict_pop, etc.

In this case though, we already have a conflict, so it may be possible to 
resolve the issue through clear parameter descriptions, indicating that "hi=-1" 
and "hi=None" are implementation details and that it is intended that the user 
never explicitly pass in either of those values, and that only the guaranteed 
ways to get the default is to omit the argument entirely or to pass in 
"hi=len(a)" as a numeric argument.

--

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I left this issue open for documenting the wordcode. Now opened separate 
issue28810 for this.

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Please take a look at issue28810. Most bytecode changes are not documented.

--

___
Python tracker 

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



[issue28810] Document bytecode changes in 3.6

2016-11-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

There are many bytecode changes in 3.6, but seems most of them are not 
documented (besides short line in _bootstrap_external.py).

* The bytecode now uses 16 bit units (wordcode) (issue26647).

* Added FORMAT_VALUE opcode (issue25483).

* Added BUILD_CONST_KEY_MAP opcode (issue27140).

* Added BUILD_STRING opcode (issue27078).

* Added BUILD_TUPLE_UNPACK_WITH_CALL opcode (issue28257).

* Added SETUP_ANNOTATIONS and STORE_ANNOTATION opcodes (issue27985).

* Changed CALL_FUNCTION, CALL_FUNCTION_KW and BUILD_MAP_UNPACK_WITH_CALL 
opcodes, removed CALL_FUNCTION_VAR, CALL_FUNCTION_VAR_KW opcodes, added 
CALL_FUNCTION_EX opcode (issue27213).

* Changed MAKE_FUNCTION opcode, removed MAKE_CLOSURE opcode (issue27095).

* Not related to the bytecode itself: lineno delta of code.co_lnotab now is 
signed (issue26107).

There are third-party projects that need correct information about bytecode 
changes.

--
assignee: docs@python
components: Documentation
messages: 281788
nosy: docs@python, serhiy.storchaka
priority: high
severity: normal
stage: needs patch
status: open
title: Document bytecode changes in 3.6
type: enhancement
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



[issue28809] mention asyncio.gather non-deterministic task starting order

2016-11-26 Thread Soren Solari

New submission from Soren Solari:

https://github.com/python/asyncio/issues/432

asyncio.gather documentation states:
"the returned future’s result is the list of results (in the order of the 
original sequence, not necessarily the order of results arrival)"

An additional statement like "tasks are not guaranteed to be started in a 
predicable order" would aid users and slove the discussion in issue 432 above.

--
assignee: docs@python
components: Documentation
messages: 281787
nosy: Soren Solari, docs@python
priority: normal
severity: normal
status: open
title: mention asyncio.gather non-deterministic task starting order
type: enhancement
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



[issue28739] PEP 498: docstrings as f-strings

2016-11-26 Thread Guido van Rossum

Guido van Rossum added the comment:

OK, clearly the code that sets __doc__ is too closely tied to the generated
code (or to the reduced AST used to generate code). I still think code that
uses any of these is on thin ice and should expect to be broken in the
future.

--

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Ah? Can you please elaborate your secret plan? :-)

I already said about this. Move the part of parsing keyword argument outside of 
the function. The caller should unpack keyword arguments and pass just a raw 
array of PyObject*. Missed arguments are set to NULL. This could make 
_PyArg_ParseStack() simpler and might even allow to inline arguments parsing 
code.

--

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL

2016-11-26 Thread Stefan Krah

Stefan Krah added the comment:

There are a couple of problems with using Argument Clinic for third
party projects.

First, it makes no stability promises:

"Currently Argument Clinic is considered internal-only for CPython. ..."


Then, for large projects that already use some generated code (like
NumPy), IMO the result would be unmaintainable.


So it would be nice to have a public stable API -- of course there
is no hurry if Serhiy has plans to improve it.

--

___
Python tracker 

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



[issue28808] Make PyUnicode_CompareWithASCIIString() never failing

2016-11-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: 
http://bugs.python.org/file45656/PyUnicode_CompareWithASCIIString-no-errors.patch

___
Python tracker 

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



[issue28808] Make PyUnicode_CompareWithASCIIString() never failing

2016-11-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: 
http://bugs.python.org/file45655/PyUnicode_CompareWithASCIIString-no-errors.patch

___
Python tracker 

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



[issue28808] Make PyUnicode_CompareWithASCIIString() never failing

2016-11-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

PyUnicode_CompareWithASCIIString() never set an exception in 3.2 and earlier 
versions. Since 3.3 it sets an exception and returns -1 if the first argument 
is not ready Unicode object, but this was not documented until issue28701. Due 
to undocumenting this behavior many (if not all) callers don't check whether it 
returned an error.

Proposed patch restores old behavior of PyUnicode_CompareWithASCIIString().

--
components: Interpreter Core, Unicode
files: PyUnicode_CompareWithASCIIString-no-errors.patch
keywords: patch
messages: 281783
nosy: ezio.melotti, haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Make PyUnicode_CompareWithASCIIString() never failing
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: 
http://bugs.python.org/file45655/PyUnicode_CompareWithASCIIString-no-errors.patch

___
Python tracker 

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



[issue28758] UnicodeDecodeError: 'gbk' codec can't decode byte 0xab in position 74: illegal multibyte sequence

2016-11-26 Thread Steve Dower

Steve Dower added the comment:

Unless the reporter comes back with more information, I'll assume it's not a 
bug.

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

___
Python tracker 

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



[issue24339] iso6937 encoding missing

2016-11-26 Thread John Helour

John Helour added the comment:

If I take the ISO_6937 file as a template for encoding table then
increasing the range 0x20..0x7f to 0x00..0xA0 is the simplest solution.

--
Added file: http://bugs.python.org/file45654/iso6937.py

___
Python tracker 

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



[issue24339] iso6937 encoding missing

2016-11-26 Thread John Helour

John Helour added the comment:

If I take the ISO_6937 file as a template for encoding table then
increasing the range 0x20..0x7f to 0x00..0xA0 is the simplest solution.

--

___
Python tracker 

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



[issue24339] iso6937 encoding missing

2016-11-26 Thread John Helour

Changes by John Helour :


Removed file: http://bugs.python.org/file45647/iso6937.py

___
Python tracker 

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



[issue8145] Documentation about sqlite3 isolation_level

2016-11-26 Thread Aviv Palivoda

Changes by Aviv Palivoda :


--
nosy: +palaviv

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread STINNER Victor

STINNER Victor added the comment:

Argument Clinic adds a signature and a better docstring. So I like it!

Speedup for tiny lists is just a nice side effect.

--

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL

2016-11-26 Thread STINNER Victor

STINNER Victor added the comment:

Is it possible to use Argument Clinic for third party extensions? If yes, I
suggest to use it.

It would also be nice if Cython could use it automatically. So we can
suggest to use Cython. I don't know well Cython, maybe your idea is very
dumb :-)

Serhiy Storchaka added the comment:
> I suggest to keep it internal. It's meaning may be changed in future. I
have some ideas about making it more convenient and faster (but I'm not
sure that they would work).

Ah? Can you please elaborate your secret plan? :-)

--

___
Python tracker 

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



[issue26483] docs unclear on difference between str.isdigit() and str.isdecimal()

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

Proposing a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file45653/issue26483.diff

___
Python tracker 

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



[issue28807] [NetBSD] interpreter hangs on exit after call to subprocess.Popen()

2016-11-26 Thread Oskar Skog

Oskar Skog added the comment:

I really need a "stupid"-helmet today.

Reopen if you can experience the same bug on a different platform.

--
resolution:  -> third party
status: open -> closed

___
Python tracker 

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



[issue26363] __builtins__ propagation is misleading described in exec and eval documentation

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

Hi Xavier, thanks for reporting,

Your first point is right, the implementation being:

 if (PyDict_GetItemString(globals, "__builtins__") == NULL) {
 if (PyDict_SetItemString(globals, "__builtins__",
  PyEval_GetBuiltins()) != 0)
 return NULL;
 }

See proposed diff.


For the second point, it looks right to me in the documentation, literally: "A 
reference to the dictionary of the builtin module builtins is inserted", so:

It's a dict:

>>> exec('print(type(globals()["__builtins__"]))', {})


It's the reference to the dict of the builtins module:

>>> exec('globals()["__builtins__"]["len"] = "foo"', {})
>>> len
'foo'

If you still think there's inconsistencies, please provide some code to 
reproduce it.

--
keywords: +patch
Added file: http://bugs.python.org/file45652/issue26363.patch

___
Python tracker 

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



[issue24339] iso6937 encoding missing

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

According to https://webstore.iec.ch/preview/info_isoiec6937%7Bed3.0%7Den.pdf:

> NOTE: The shaded positions 00/00 to 01/15 and 07/15 to 09/15 are outside the 
> scope of this International Standard.

So it's clear to me that they are not undefined, they are just described 
elsewhere.

According to https://en.wikipedia.org/wiki/ISO/IEC_6937:
>ISO/IEC 6937:2001, [...] is a multibyte extension of ASCII

Also, the glibc charmap for ISO_6937 define them:

$ head -n 20 localedata/charmaps/ISO_6937
 ISO_6937
 %
 /
% version: 1.0
%  source: ECMA registry and ISO/IEC 6937:1992

% alias ISO-IR-156
% alias ISO_6937:1992
% alias ISO6937
CHARMAP
 /x00 NULL (NUL)
 /x01 START OF HEADING (SOH)
 /x02 START OF TEXT (STX)
 /x03 END OF TEXT (ETX)
 /x04 END OF TRANSMISSION (EOT)
 /x05 ENQUIRY (ENQ)
 /x06 ACKNOWLEDGE (ACK)
 /x07 BELL (BEL)
 /x08 BACKSPACE (BS)
 /x09 CHARACTER TABULATION (HT)

Finally, if we're not implementing this range, this mean we have _no_ way to 
encode a new line, which looks highly strange to me, newline being a commonly 
used character.

But I found _no_ line in the whole ISO/IEC6937 about its ASCII inheritance, I 
may have just missed it.

--

___
Python tracker 

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



[issue28807] [NetBSD] interpreter hangs on exit after call to subprocess.Popen()

2016-11-26 Thread Oskar Skog

New submission from Oskar Skog:

This is a platform specific bug.  Only noticed this on NetBSD 6.1 x86-32 on a 
VirtualBox machine.

To me, the patches for NetBSD do not look relevant to subprocess or core stuff.
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/lang/python27/patches/?only_with_tag=MAIN


Test:

#!/usr/pkg/bin/python
import subprocess
subprocess.Popen(['true'])
print('Program finished.')
# END OF FILE

On an unaffected platform it will print "Program finished." and exit, on an 
affected platform it will print "Program finished." and hang.

--
components: Interpreter Core
messages: 281773
nosy: oskog97
priority: normal
severity: normal
status: open
title: [NetBSD] interpreter hangs on exit after call to subprocess.Popen()
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

Hi Serhiy,

hi: Py_ssize_t(py_default="len(a)") = -1

Won't works, as pydoc will use the inspect module (_signature_fromstr) to get 
the signature. _signature_fromstr expects a valid python signature, but `def 
foo(a, x, lo=0, high=len(a)): pass` is not valid (SyntaxError).

Should we note that in the clinic documentation:

> py_default
> default as it should appear in Python code, as a string. Or None if there 
> is no default.

> py_default
> default as it should appear in valid Python code, as a string. Or None if 
> there is no default.

?

--

___
Python tracker 

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



[issue27777] cgi.FieldStorage can't parse simple body with Content-Length and no Content-Disposition

2016-11-26 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suggest to keep it internal. It's meaning may be changed in future. I have 
some ideas about making it more convenient and faster (but I'm not sure that 
they would work).

--

___
Python tracker 

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



[issue28763] Use en-dashes for ranges in docs

2016-11-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 77307437ae15 by Serhiy Storchaka in branch '3.5':
Issue #28763: Use double hyphens (rendered as en-dashes) in numerical ranges
https://hg.python.org/cpython/rev/77307437ae15

New changeset 59bd48afa1bc by Serhiy Storchaka in branch '2.7':
Issue #28763: Use double hyphens (rendered as en-dashes) in numerical ranges
https://hg.python.org/cpython/rev/59bd48afa1bc

New changeset 3434d84efdd4 by Serhiy Storchaka in branch '3.6':
Issue #28763: Use double hyphens (rendered as en-dashes) in numerical ranges
https://hg.python.org/cpython/rev/3434d84efdd4

New changeset dc407f50e823 by Serhiy Storchaka in branch 'default':
Issue #28763: Use double hyphens (rendered as en-dashes) in numerical ranges
https://hg.python.org/cpython/rev/dc407f50e823

--
nosy: +python-dev

___
Python tracker 

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



[issue28763] Use en-dashes for ranges in docs

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Terry.

--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed
versions: +Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

Hi Serhiy,

> Julien, you can declare the hi parameter as
>hi: Py_ssize_t(py_default="len(a)") = -1

Looks like a good idea, I was aware of its existance but did not took the time 
to read the doc about it, kind of learning step by stpe. But as you provided 
the syntax, I tested it, thanks for this! But it fails with a RuntimeError 
during python -m pydoc _bisect, I'm currently trying to understand why:

$ ./python -m pydoc _bisect 
Traceback (most recent call last):
  File "/home/mdk/cpython-git/Lib/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "/home/mdk/cpython-git/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 2663, in 
cli()
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 2628, in cli
help.help(arg)
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 1908, in help
elif request: doc(request, 'Help on %s:', output=self._output)
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 1645, in doc
pager(render_doc(thing, title, forceload))
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 1638, in render_doc
return title % desc + '\n\n' + renderer.document(object, name)
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 382, in document
if inspect.ismodule(object): return self.docmodule(*args)
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 1172, in docmodule
contents.append(self.document(value, key, name))
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 384, in document
if inspect.isroutine(object): return self.docroutine(*args)
  File "/home/mdk/cpython-git/Lib/pydoc.py", line 1357, in docroutine
signature = inspect.signature(object)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 2994, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 2744, in from_callable
follow_wrapper_chains=follow_wrapped)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 2223, in 
_signature_from_callable
skip_bound_arg=skip_bound_arg)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 2055, in 
_signature_from_builtin
return _signature_fromstr(cls, func, s, skip_bound_arg)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 2003, in _signature_fromstr
p(name, default)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 1985, in p
default_node = RewriteSymbolics().visit(default_node)
  File "/home/mdk/cpython-git/Lib/ast.py", line 253, in visit
return visitor(node)
  File "/home/mdk/cpython-git/Lib/ast.py", line 317, in generic_visit
new_node = self.visit(old_value)
  File "/home/mdk/cpython-git/Lib/ast.py", line 253, in visit
return visitor(node)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 1977, in visit_Name
return wrap_value(node.id)
  File "/home/mdk/cpython-git/Lib/inspect.py", line 1959, in wrap_value
raise RuntimeError()
RuntimeError


> > Curiously, this patch gives about a 10% to 15% speedup.  Any sense of how 
> > that improvement arises?
> This is rather a random difference. Try to run the bench several times.  With 
> using Victor's perf module the difference is not significant.

If you search for "perf" in the history of this issue you'll see that I already 
tested with Victor's perf module and it yielded a consistent 18% improvement on 
bisect.bisect("abcdef", "c") on two different machines. Clearly with more than 
5 items, it will start to fade, and with a lot of items, it's not significand, 
obviously as it's an optimization about the call and not the implementation. So 
Raymond's test with 100 items may still see a speedup.

--

___
Python tracker 

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



[issue28780] netrc throws NetrcParseError for record without 'password'

2016-11-26 Thread Xiang Zhang

Changes by Xiang Zhang :


--
dependencies: +Improve the netrc library

___
Python tracker 

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



[issue28806] Improve the netrc library

2016-11-26 Thread Xiang Zhang

New submission from Xiang Zhang:

netrc library now gets some problems:

1. All tokens are mandatory. (#28780)
2. Token values are limited to a limited set of characters. (#557704)
3. Does not complain about macro definition without a null line.
4. If the login name is anonymous, security check is not needed.

Propose a patch to handle these. I treat it as an enhancement of the existing 
library instead of bug fix.

--
components: Library (Lib)
files: netrc.patch
keywords: patch
messages: 281767
nosy: haypo, xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: Improve the netrc library
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file45651/netrc.patch

___
Python tracker 

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



[issue28805] Add documentation for METH_FASTCALL

2016-11-26 Thread Stefan Krah

New submission from Stefan Krah:

It looks like METH_FASTCALL gives nice speedups (#28754).

Is this an internal interface or can it be documented like
METH_KEYWORDS etc.?

--
assignee: docs@python
components: Documentation
messages: 281766
nosy: docs@python, haypo, serhiy.storchaka, skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: Add documentation for METH_FASTCALL
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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Julien, you can declare the hi parameter as

hi: Py_ssize_t(py_default="len(a)") = -1

if you want the signature be matching the documentation.

In general, it is better to use converter names rather than format codes.

> Curiously, this patch gives about a 10% to 15% speedup.  Any sense of how 
> that improvement arises?

This is rather a random difference. Try to run the bench several times.  With 
using Victor's perf module the difference is not significant.

Maybe using FASTCALL have some positive effect, but it is unlikely noticeable 
with such complex function.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

Hi Raymond,

> Curiously, this patch gives about a 10% to 15% speedup.  Any sense of how 
> that improvement arises?

That's because Argument Clinic is generating methoddef with METH_FASTCALL:

$ grep FASTCALL Modules/clinic/_bisectmodule.c.h 
{"bisect_right", (PyCFunction)bisect_bisect_right, METH_FASTCALL, 
bisect_bisect_right__doc__},
{"insort_right", (PyCFunction)bisect_insort_right, METH_FASTCALL, 
bisect_insort_right__doc__},
{"bisect_left", (PyCFunction)bisect_bisect_left, METH_FASTCALL, 
bisect_bisect_left__doc__},
{"insort_left", (PyCFunction)bisect_insort_left, METH_FASTCALL, 
bisect_insort_left__doc__},

Instead of METH_VARARGS|METH_KEYWORDS:

-{"bisect_right", (PyCFunction)bisect_right,
-METH_VARARGS|METH_KEYWORDS, bisect_right_doc},
-{"insort_right", (PyCFunction)insort_right,
-METH_VARARGS|METH_KEYWORDS, insort_right_doc},
-{"bisect_left", (PyCFunction)bisect_left,
-METH_VARARGS|METH_KEYWORDS, bisect_left_doc},
-{"insort_left", (PyCFunction)insort_left,
-METH_VARARGS|METH_KEYWORDS, insort_left_doc},

--

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Curiously, this patch gives about a 10% to 15% speedup.  Any sense of how that 
improvement arises?

$ py3.7 -m timeit -s 'from bisect import bisect' -s 'a=list(range(100))' 
'bisect(a, 10)'

229 nsec # Clang baseline 
202 nsec # Clang with patch

189 nsec # GCC-6 baseline
156 nsec # Gcc-6 with patch

--

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

Should we also update howto/clinic, bullet "11.", to be explicit about not 
adding per-parameter in the same patch? Like a:

> If you're porting existing function to Argument clinic, skip this step to 
> simplify code review.

?

--

___
Python tracker 

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



[issue28754] Argument Clinic for bisect.bisect_left

2016-11-26 Thread Julien Palard

Julien Palard added the comment:

Here is the new patch, I ran a diff between "./python -m pydoc _bisect" before 
and after my patch, here it is:

13,15c13
< bisect_left(...)
< bisect_left(a, x[, lo[, hi]]) -> index
< 
---
> bisect_left(a, x, lo=0, hi=-1)
25,27c23
< bisect_right(...)
< bisect_right(a, x[, lo[, hi]]) -> index
< 
---
> bisect_right(a, x, lo=0, hi=-1)
32c28
< beyond the rightmost x already there
---
> beyond the rightmost x already there.
37,39c33
< insort_left(...)
< insort_left(a, x[, lo[, hi]])
< 
---
> insort_left(a, x, lo=0, hi=-1)
47,49c41
< insort_right(...)
< insort_right(a, x[, lo[, hi]])
< 
---
> insort_right(a, x, lo=0, hi=-1)

So I kept my addition of the missing full stop, and dropped the handwritten 
signature as Argument Clinic generates it.

--
Added file: http://bugs.python.org/file45650/issue28754-6.diff

___
Python tracker 

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



[issue28682] Bytes support in os.fwalk()

2016-11-26 Thread Antti Haapala

Antti Haapala added the comment:

shouldn't this get in sooner, as the 3.5.2 documentation says that it behaves 
exactly like `os.walk`, with some additions, none of which says "bytes paths 
are not supported". This looks like a bug to me.

--
nosy: +ztane

___
Python tracker 

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



[issue28799] Drop CALL_PROFILE special build?

2016-11-26 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +Jeremy.Hylton

___
Python tracker 

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



[issue28739] PEP 498: docstrings as f-strings

2016-11-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Adding more confusion, the expression ``('This is a docstring')`` is accepted 
as a docstring despite the fact that it is not a string literal.

The cases f'string' and ('string') looks similar to me. Both are simple 
expressions that become indistinguishable from string literals due to some 
optimization at parser level. It would be nice to disallow them as docstrings, 
but it may be not easy to do.

--
nosy: +serhiy.storchaka

___
Python tracker 

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