[issue22350] nntplib file write failure causes exception from QUIT command

2015-05-25 Thread Martin Panter

Martin Panter added the comment:

For the record, the SMTP scenario was Issue 17498, where code that is about to 
raise an exception attempts an RSET command that could also fail.

I do think each change in my patch is essentially the same case: restoring the 
invariant expected by the __exit__() method, that either the protocol state 
allows QUIT, or there is no connection. But I agree it may help divide this 
into smaller pieces. I am uploading getlongresp-loop.patch, which fixes just 
the receiving loop in _getlongresp().

I have also added some logic to avoid errors raised when flushing and closing 
the socket do not mask the original exception, which I understand David was 
concerned about. I guess it is possible (though unlikely) that an EPIPE or 
ECONNRESET flushing the send buffer could mask a KeyboardInterrupt raised 
inside the loop.

Sorry I took a while to follow up on this, but please have a look and let me 
know if this simplified patch makes any sense.

--
Added file: http://bugs.python.org/file39490/getlongresp-loop.patch

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



[issue5315] signal handler never gets called

2015-05-25 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

Adding haypo since apparently he's been touching signals stuff a lot lately, 
maybe has some useful thoughts / review? :)

--
nosy: +haypo

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



[issue24283] Print not safe in signal handlers

2015-05-25 Thread Devin Jeanpierre

New submission from Devin Jeanpierre:

The code attached runs a while loop that prints, and has a signal handler that 
also prints. There is a thread that constantly fires off signals, but this is 
just to ensure the condition for the bug happens -- this is a bug with signal 
handling, not threads -- I can trigger a RuntimeError (... with a missing 
message?) by commenting out the threading lines and instead running a separate 
process while true; do kill -s SIGUSR1 4687; done.

Traceback:

$ python3 threading_print_test.py 
hello
world
Traceback (most recent call last):
  File /usr/local/google/home/devinj/Downloads/threading_print_test.py, line 
36, in module
main()
  File /usr/local/google/home/devinj/Downloads/threading_print_test.py, line 
30, in main
print(world)
  File /usr/local/google/home/devinj/Downloads/threading_print_test.py, line 
13, in print_hello
print(hello)
RuntimeError: reentrant call inside _io.BufferedWriter name='stdout'

--
files: threading_print_test.py
messages: 244020
nosy: Devin Jeanpierre, haypo
priority: normal
severity: normal
status: open
title: Print not safe in signal handlers
Added file: http://bugs.python.org/file39491/threading_print_test.py

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



[issue23237] Interrupts are lost during readline PyOS_InputHook processing (reopening)

2015-05-25 Thread Martin Panter

Martin Panter added the comment:

I left a couple comments on Reitveld. The main question is: is there any reason 
why we can’t poll PyErr_CheckSignals() directly the tkinter EventHook loop, 
rather than juggling a new SIGINT handler then reraising it? That way we might 
trigger other Python signal handlers properly as well.

--

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



[issue24282] 3.5 gdbm extension build fails with 'clinic/_gdbmmodule.c.h' file not found

2015-05-25 Thread Jyrki Wahlstedt

New submission from Jyrki Wahlstedt:

On OS X (with MacPorts) the following happens:
===
DEBUG: Environment: 
CC='/usr/bin/clang'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_jwa_work_macports-trunk_dports_python_py-gdbm/py35-gdbm/work/.CC_PRINT_OPTIONS'
CFLAGS='-arch x86_64'
CPATH='/opt/local/include'
CXX='/usr/bin/clang++'
CXXFLAGS='-arch x86_64'
F90FLAGS='-m64'
FCFLAGS='-m64'
FFLAGS='-m64'
LDFLAGS='-arch x86_64'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='10.10'
OBJC='/usr/bin/clang'
OBJCFLAGS='-arch x86_64'
DEBUG: Assembled command: 'cd 
/opt/local/var/macports/build/_Users_jwa_work_macports-trunk_dports_python_py-gdbm/py35-gdbm/work/Python-3.5.0b1/Modules
  /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 
setup.py --no-user-cfg build'
DEBUG: Executing command line:  cd 
/opt/local/var/macports/build/_Users_jwa_work_macports-trunk_dports_python_py-gdbm/py35-gdbm/work/Python-3.5.0b1/Modules
  /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 
setup.py --no-user-cfg build 
running build
running build_ext
building '_gdbm' extension
creating build
creating build/temp.macosx-10.10-x86_64-3.5
/usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch x86_64 
-I/opt/local/include 
-I/opt/local/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m
 -c _gdbmmodule.c -o build/temp.macosx-10.10-x86_64-3.5/_gdbmmodule.o
_gdbmmodule.c:45:10: fatal error: 'clinic/_gdbmmodule.c.h' file not found
#include clinic/_gdbmmodule.c.h
 ^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
===

--
components: Extension Modules
messages: 244017
nosy: jwa
priority: normal
severity: normal
status: open
title: 3.5 gdbm extension build fails with 'clinic/_gdbmmodule.c.h' file not 
found
type: compile error
versions: Python 3.5

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



[issue24282] 3.5 gdbm extension build fails with 'clinic/_gdbmmodule.c.h' file not found

2015-05-25 Thread Jyrki Wahlstedt

Jyrki Wahlstedt added the comment:

This worked ok in a3… (not in a4 anymore)

--

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



[issue24282] 3.5 gdbm extension build fails with 'clinic/_gdbmmodule.c.h' file not found

2015-05-25 Thread Ned Deily

Ned Deily added the comment:

The problem you are seeing is due to MacPort's non-standard method of building 
the gdbm module separately in a stand-alone build instead of during the normal 
building of the complete Python standard library.  As of 3.5.0a4 with 
49910ff21ba5 for Issue20184, Modules/_gdbmmodule.c was converted to use the 
Argument Clinic DSL feature (PEP 436).  For each converted .c module in 
Modules, Argument Clinic creates a corresponding new header file in the clinic 
subdirectory, in this case, Modules/clinic/_gdbmmodule.c.h.  I believe you will 
need to modify the py3x-gdbm portfiles to also extract the contents of 
Modules/clinic into the build source directory.  Note, you may need to do this 
for any other similar portfiles.

--
nosy: +ned.deily
resolution:  - third party
stage:  - resolved
status: open - closed

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



[issue24275] lookdict_* give up too soon

2015-05-25 Thread Mark Shannon

Mark Shannon added the comment:

I don't understand why this has been closed.
I agree with Jim's analysis.

Lookups do not change the dict and the choice of lookdict_* variant depends 
solely on the set of keys.

In fact, lookdict_split *doesn't* replace itself, it merely calls look_dict, 
leaving maintaining the invariant to insertdict.

Benjamin, could you please reopen this and mark it as needing a patch.

--
nosy: +Mark.Shannon

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



[issue24282] 3.5 gdbm extension build fails with 'clinic/_gdbmmodule.c.h' file not found

2015-05-25 Thread Jyrki Wahlstedt

Jyrki Wahlstedt added the comment:

Thanks for the quick follow-up! I'll get the work done at our end:)

--

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



[issue23969] please set a SOABI for MacOSX

2015-05-25 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Ned: Keeping darwin as the platform tag is fine with me. It is slightly ugly 
because it doesn't match the platform tag used by distutils/setuptools, but is 
also something that most users won't use directly.

That said: there was some talk about supporting iOS on python-ideas a while 
back, and using darwin as the platform tag for both would mean that you 
couldn't have a tree with extensions for both at the same time (assuming you 
can have extensions on iOS in the first place, I haven't kept track about the 
possibilities for shared libraries on iOS and it wasn't possible in the past)

The suffix change would be nice to have, but I haven't thought about the 
implications for 3th-party tools at all. I agree that this could cause problems 
for them, and that's not worth the very minor improvement in nameing.

--
status: pending - open

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



[issue24275] lookdict_* give up too soon

2015-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is not obvious that the patch is needed. If you have ready patch and good 
benchmark results, you could reopen the issue. Otherwise status quo wins.

--
nosy: +serhiy.storchaka

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



[issue24243] behavior for finding an empty string is inconsistent with documentation

2015-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Opened separate issue24284 for inconsistency in startswith/endswith.

--

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



[issue24284] Inconsistency in startswith/endswith

2015-05-25 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The behavior of startswith in corner case is inconsistent between str and bytes 
in Python 3, str and unicode in Python 2, and between str in Python 2 and 
Python 3.

Python 3:
 ''.startswith('', 1, 0)
True
 b''.startswith(b'', 1, 0)
False

Python 2:
 ''.startswith('', 1, 0)
False
 u''.startswith(u'', 1, 0)
True

If define s1.startswith(s2, start, end) for non-negative indices and non-tuple 
s2 as an equivalent to the expression `start + len(s2) = end and s2[start: 
start + len(s2)] == s2` or to `s1.find(s2, start, end) == start`, 
.startswith(, 1, 0) should be False.

The same issue exists for endswith. See issue24243 for more detailed discussion.

Proposed patch fixes str.startswith and str.endswith.

--
components: Interpreter Core
files: str_tailmatch.patch
keywords: patch
messages: 244027
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Inconsistency in startswith/endswith
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file39492/str_tailmatch.patch

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



[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-25 Thread Petr Viktorin

Petr Viktorin added the comment:

Yes, you did find an error. Thanks for reporting it!

Here is a fix with a test case.

--
Added file: http://bugs.python.org/file39493/fix-pep489-submodule.patch

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



[issue24285] regression for importing extensions in packages

2015-05-25 Thread Ronald Oussoren

New submission from Ronald Oussoren:

PyObjC has an extension that's imported as objc._objc. This works fine on 
version upto the 3.5 beta (checkout from earlier today).

With that I get the following exception:

Python 3.5.0b1+ (default:7255af1a1c50+, May 25 2015, 11:46:18) 
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type help, copyright, credits or license for more information.
 import objc
Traceback (most recent call last):
  File stdin, line 1, in module
  File 
/Users/ronald/Projects/pyobjc-hg/pyobjc/pyobjc-core/Lib/objc/__init__.py, 
line 18, in module
_update()
  File 
/Users/ronald/Projects/pyobjc-hg/pyobjc/pyobjc-core/Lib/objc/__init__.py, 
line 15, in _update
import objc._objc as _objc
ImportError: dynamic module does not define module export function 
(PyInit_._objc)

--
messages: 244030
nosy: brett.cannon, eric.snow, ncoghlan, ronaldoussoren
priority: high
severity: normal
status: open
title: regression for importing extensions in packages
versions: Python 3.5

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



[issue24285] regression for importing extensions in packages

2015-05-25 Thread Ronald Oussoren

Ronald Oussoren added the comment:

The attached patch appears to fix the issue. This appears to be an off-by-one 
error.

--
stage:  - needs patch
type:  - behavior
Added file: http://bugs.python.org/file39494/issue-24285.txt

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



[issue24278] Docs on Parsing arguments should say something about mem mgmt for formatters returning C strings

2015-05-25 Thread Martin Blais

Martin Blais added the comment:

Adding information that tells developers where the memory for those returned 
areas is stored and as you mention, its lifetime guarantees w.r.t. to the 
Python object, would go a long way towards making this more clear. The 
questions that immediately came to my mind were:

- Is this memory attached to the object?

- What if there is a conversion... is it still attached to the object? The 
converter for s says Unicode objects are converted to C strings using 
'utf-8' encoding.  Where is the output of this conversion stored? Does it have 
the same lifetime as its PyObject as well or does it use a cache of recent 
conversions (e.g. like re/struct), or just static storage? And if so, is it 
thread-safe?

I can find all these answers by looking at the source code for C/Python, or I 
can _guess_ that extra data is attached to some sort of 'extra' field in a 
PyObject (which would be a sensible thing to do), but my point is that an API 
user shouldn't have to dig in the source or have to guess for such important 
concerns. I think we should be a bit more transparent in the docs.

--

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



[issue24278] Docs on Parsing arguments should say something about mem mgmt for formatters returning C strings

2015-05-25 Thread Martin Blais

Martin Blais added the comment:

Oh, and yes, just adding this info at the top would be fine IMO. It shouldn't 
have to be repeated.

--

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



[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-25 Thread Ronald Oussoren

Ronald Oussoren added the comment:

See issue 24285, I ran into the same issue as mention in msg244008. That issue 
has a patch.

--
nosy: +ronaldoussoren

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



[issue24285] regression for importing extensions in packages

2015-05-25 Thread Petr Viktorin

Petr Viktorin added the comment:

issue 24268 has a patch with a test case.

--
nosy: +encukou

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



[issue24283] Print not safe in signal handlers

2015-05-25 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +pitrou

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



[issue24284] Inconsistency in startswith/endswith

2015-05-25 Thread R. David Murray

R. David Murray added the comment:

I think this can only be applied in a feature release (and I think it should 
be, because of the backward-compatibility-with-python2 issue).  However, since 
this is potentially controversial, we need some more opinions.

--
nosy: +r.david.murray
versions:  -Python 2.7, Python 3.4, Python 3.6

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



[issue24283] Print not safe in signal handlers

2015-05-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 RuntimeError: reentrant call inside _io.BufferedWriter name='stdout'

As the exception message suggests: the IO stack is not reentrant. If an ongoing 
IO call is interrupted by a signal, and the signal handler calls again into the 
IO stack, this situation is detected and an error is raised. If instead we 
allowed the IO call to continue, all sorts of problems could ensue (data loss, 
crashes...).

So, indeed, print() is not safe in signal handlers. Though the fact that it 
raises an exception, rather than crashes, makes things easier for the developer 
;)

--
resolution:  - wont fix
stage:  - resolved
status: open - closed

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



[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-25 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

 Yes, you did find an error. Thanks for reporting it!
 Here is a fix with a test case.

Thanks, I was unsure if there would have been side effect or other things to 
fix. I would have submitted a patch otherwise. 

Thanks.

--

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



[issue24283] Print not safe in signal handlers

2015-05-25 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

It doesn't do any of those things in Python 2, to my knowledge. Why aren't we 
willing to make this work?

--

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



[issue24283] Print not safe in signal handlers

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

 It doesn't do any of those things in Python 2, to my knowledge.

Well, even if Python 2 doesn't warn you,  threading_print_test.py is also wrong 
on Python 2. Python 3 is better because it warns you :-)

 Why aren't we willing to make this work?

It would be very complex to support reentrant calls in the io stack. It's much 
easier to redesign your application to defer the work of the signal handler 
outside the signal handler.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

@Jim,

You've got some good questions.  I'll look into them today.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

@mrab

gah! I could swear I originally had the _odict_clear_node first and had 
switched them due to a segfault.  It even crossed my mind on Friday but I 
didn't pursue it.  I'm guessing I did put the _odict_clear_node call first at 
some point but lost that fix along the way. :(  That's the benefit of having 
a patch languish for so long; you end up working on it from multiple hosts and 
sometimes lose bits and pieces.  Unfortunately only recently did I think to 
create a feature repo on which to track the on-going work.

Anyway, thanks for helping with the investigation.  The patch should be just 
about ready to commit at this point. :)  I'm going to give it a once over, 
check for any lingering ref leaks, and double-check with Raymond.  So I'm 
hopeful we can land this in the next few days.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

 I'm going to echo the previous comment that maybe trying to emulate the 
 existing dict implementation too carefully just adds complexity.

The whole dance with _odict_get_index and _odict_resize is due to the
requirement that OrderedDict maintain O(1) operation for deletion
operations.  Due to using a linked list, we needed a secondary
mechanism for efficiently indexing into the list.  There is a note at
the top of the file explaining the alternatives I considered and the
rationale for mirroring dict's hash table.


 The split-keys implementation shows that there is at least some flexibility 
 to the implementation.  Enough that the keys could map to an array offset, 
 rather than directly to the values?

What do you mean by this?  If you are suggesting changes to dict or
its accessory types then it is something I considered and rejected.
Personally I don't want to change anything on dict itself for the sake
of OrderedDict.  If others would like to pursue that they're welcome
to do so. :)

--

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



[issue24270] PEP 485 (math.isclose) implementation

2015-05-25 Thread Tal Einat

Tal Einat added the comment:

Attached is a slightly revised patch.

This mostly fixes minor documentation wording and formatting issues, including 
those pointed out by Chris Barker on the python-dev mailing list.

Also, since it has been decided to support complex values only in a separate 
cmath.isclose() function, the previously included commented-out complex test 
cases have been removed.

--
Added file: http://bugs.python.org/file39495/math_isclose_v2.patch

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



[issue24281] String formatting: incorrect number of decimal places

2015-05-25 Thread Eric V. Smith

Eric V. Smith added the comment:

Just to clarify:

If not specified, the default presentation type for floats is g. Since you 
didn't specify f in your example, it's using g. For presentation type g, 
the precision (3 in your case) is the total number of significant digits. So 
12.34 first becomes 12.3, then that's displayed in a field 8 characters wide, 
which gives you the 4 leading zeros.

See the section of presentation types for floating point at the end of this 
section:
https://docs.python.org/2/library/string.html#format-specification-mini-language

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

 Should dictobject.h get a bit more changes?  In particular, should the 
 following be expanded?

 #define PyDictKeys_Check(op) (Py_TYPE(op) == PyDictKeys_Type)
 #define PyDictItems_Check(op) (Py_TYPE(op) == PyDictItems_Type)
 #define PyDictValues_Check(op) (Py_TYPE(op) == PyDictValues_Type)
 /* This excludes Values, since they are not sets. */
 # define PyDictViewSet_Check(op) \
 (PyDictKeys_Check(op) || PyDictItems_Check(op))

I'm missing some context here.  I'm not sure how this relates to OrderedDict.

--

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



[issue24285] regression for importing extensions in packages

2015-05-25 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
resolution:  - duplicate
stage: needs patch - resolved
status: open - closed
superseder:  - PEP 489 -- Multi-phase extension module initialization

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

@Mark, great idea.  I wish we'd discussed it more at PyCon 2013 when I was 
working on preserving OrderedDict's O(1) deletion. :)

TBH, I don't have any problems with improvements.  In fact, I'd be quite happy 
if folks jumped in and improved what I've done or even replaced it entirely.  
But at the point (with the feature freeze exception Larry gave) we should land 
what I have in 3.5 and then target 3.6 for any improvements.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Mark Shannon

Mark Shannon added the comment:

I realise that I am bit late to the party, but I would like to point out that a 
smaller, arguably simpler, and almost certainly faster alternative design 
exists.

This design simply consists of an array of (prev, next, key) nodes attached to 
the base dict.

The linked list is maintained using the prev  next pointers of the nodes as 
normal.

The mapping of keys to nodes is maintained by ensuring that the index of the 
node in the node array matches the index of the key in dict-key table.
When the size of the array matches that of the keys table, this should be a 
very fast operation.

When the dict is resized, the array will need to resized. 
(Possibly lazily if PyDict_* functions are used directly on the ordered dict.)

Size analysis
-

For an an occupancy of X, 
Eric's design takes 7/X + 3 slots per key/value pair.
The alternative design takes 6/X slots per key/value pair.

For an occupancy of 50%, half way between the minimum of 1/3 and maximum of 2/3,
on a 64bit machine:
The design proposed in this issue takes 17 slots or 136 bytes per key/value 
pair.
The alternative would take 12 slots or 96 bytes per pair, about 70% of the size.

--
nosy: +Mark.Shannon

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2015-05-25 Thread Stefan Behnel

Stefan Behnel added the comment:

I noticed that my patch isn't entirely correct. If the exception value is a 
tuple, both PyErr_SetObject() and PyErr_NormalizeException() use it directly as 
*argument tuple* for the exception instantiation call, i.e. they essentially 
unpack it into separate arguments. The StopIteration value is then only the 
first item of that tuple.

I wonder if it's worth repeating this, uhm, surprising special case in yet 
another place, or if we should just always instantiate the exception.

--
status: closed - open

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



[issue23488] Random objects twice as big as necessary on 64-bit builds

2015-05-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Should this be backported?  IMO, it is a bug.

--

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



[issue24287] Let ElementTree prolog include comments and processing instructions

2015-05-25 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Currently, ElementTree doesn't support comments and processing instructions in 
the prolog.  That is the typical place to put style-sheets and document type 
definitions.

It would be used like this:

from xml.etree.ElementTree import ElementTree, Element, Comment, 
ProcessingInstruction

r = Element('current_observation', version='1.0')
r.text = 'Nothing to see here.  Move along.'
t = ElementTree(r)
t.append(ProcessingInstruction('xml-stylesheet', 'href=latest_ob.xsl 
type=text/xsl'))
t.append(Comment('Published at: 
http://w1.weather.gov/xml/current_obs/KSJC.xml'))

That creates output like this:

?xml version='1.0' encoding='utf-8'?
?xml-stylesheet href=latest_ob.xsl type=text/xsl?
!--Published at: http://w1.weather.gov/xml/current_obs/KSJC.xml--
current_observation version=1.0
Nothing to see here.  Move along.
/current_observation

--
files: xml_prolog.diff
keywords: patch
messages: 244069
nosy: eli.bendersky, rhettinger, scoder
priority: normal
severity: normal
status: open
title: Let ElementTree prolog include comments and processing instructions
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file39498/xml_prolog.diff

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
priority: release blocker - 
stage:  - patch review
versions: +Python 3.6 -Python 3.5

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


Added file: http://bugs.python.org/file39496/3b2a9026d48e.diff

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

 It may be a stretch to get this into 3.5, but the final change should be 
 pretty small.

Changing the default type of class dictionaries is a huge change. IMO it should 
be deferred to Python 3.6.

--
nosy: +haypo

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



[issue23574] datetime: support leap seconds

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

Sorry, I give up on this issue. I don't know how to fix it, nor if it's 
possible to fix it.

--
resolution:  - wont fix
status: open - closed

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



[issue23270] Use the new __builtin_mul_overflow() of Clang and GCC 5 to check for integer overflow

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

I'm no more interested to work on this issue, so I just close it. It was more a 
reminder for myself than a real issue.

--
resolution:  - fixed
status: open - closed

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

I've moved this to 3.6.  Small as the patch might be, there just isn't enough 
urgency to warrant making use of an exception to get it into 3.5.  If 
__definition_order__ were still on the table then I'd probably still push for 
3.5. :)

--

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



[issue23840] tokenize.open() leaks an open binary file on TextIOWrapper error

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

Sorry for not being more available for feedback on patches. I chose to write 
the final patch because patches were not updated to take in account my latest 
comments.

I hope that this issue helps you at least the process for reviewing patches ;-)

--
resolution:  - fixed
status: open - closed

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



[issue23840] tokenize.open() leaks an open binary file on TextIOWrapper error

2015-05-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 623e07ea43df by Victor Stinner in branch '3.4':
Issue #23840: tokenize.open() now closes the temporary binary file on error to
https://hg.python.org/cpython/rev/623e07ea43df

New changeset a640d268ba97 by Victor Stinner in branch '3.5':
(Merge 3.5) Issue #23840: tokenize.open() now closes the temporary binary file
https://hg.python.org/cpython/rev/a640d268ba97

New changeset c5cfd6353b4b by Victor Stinner in branch 'default':
(Merge 3.6) Issue #23840: tokenize.open() now closes the temporary binary file
https://hg.python.org/cpython/rev/c5cfd6353b4b

--
nosy: +python-dev

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
priority: normal - release blocker

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

Per discussion on python-dev, I'm tabling the __definition_order__ part to 3.6. 
 I'll open a thread on python-ideas on it later and open a new issue here if I 
get a positive response.

So this issue is just about making OrderedDict the default namespace type for 
class definitions.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

At present the only remaining issues with the patch are:

* 10 leaked refs in test_collections
* a failing test in test_enum

===
 key: __members__
  result: OrderedDict([('red', Color.red: 1), ('green', Color.green: 2), 
('blue', Color.blue: 3)])
expected: OrderedDict([('red', Color.red: 1), ('green', Color.green: 2), 
('blue', Color.blue: 3)])
===
test test_enum failed -- Traceback (most recent call last):
  File /home/esnow/projects/cordereddict/Lib/test/test_enum.py, line 1668, in 
test_inspect_getmembers
self.fail(result does not equal expected, see print above)
AssertionError: result does not equal expected, see print above

I'm not sure what to make of that test.  By all appearances it should be 
passing.  My guess is that there's some wackiness afoot over in Enum, but I'll 
take a closer look after I get the ref counts sorted out.

--

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Nick Coghlan

Nick Coghlan added the comment:

This is *not* about changing the default type of class dictionaries (which
I agree would be far too large a change to make without a PEP), it's only
about changing the ephemeral evaluation namespace used to execute the class
body.

--

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

This is not about changing the default type for class dictionaries.  It is only 
for changing the default type used during class definition.  Essentially, we 
are just changing the type of what is returned from `type.__prepare__`.  
cls.__dict__ will remain a dict.

--

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



[issue23754] Add a new os.read_into() function to avoid memory copies

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

Without more interested, I chose to defer this issue. Feel free to reopen it if 
you need it for more use cases, or if you are interested to implement it.

--
resolution:  - postponed
status: open - closed

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



[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee:  - rhettinger
nosy: +rhettinger

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

The failing test is not passing so I don't see any further blockers to 
committing this.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


Added file: http://bugs.python.org/file39499/c3fab329aa7f.diff

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

rather, it *is* passing now :)

--

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



[issue24287] Let ElementTree prolog include comments and processing instructions

2015-05-25 Thread Martin Panter

Martin Panter added the comment:

The ElementTree class imitates or wraps many methods of the Element class. 
Since Element.append() and remove() already exist and act on children of the 
element, I think the new ElementTree methods should be named differently. Maybe 
something like prolog_append() and prolog_remove()? Or prologue_append() 
depending on your spelling preferences :P

Also, maybe the new write() calls should add newlines.

--
nosy: +vadmium

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

I've cleaned up the patch.  I still want to make one last pass to check 
re-entrancy concerns.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


Added file: http://bugs.python.org/file39500/ba1c6d40ca63.diff

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



[issue23993] Use surrogateescape error handler by default in open() if the LC_CTYPE locale is C at startup

2015-05-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
resolution:  - fixed
status: open - closed

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



[issue23993] Use surrogateescape error handler by default in open() if the LC_CTYPE locale is C at startup

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

Without a strong support, I don't want to put this in Python 3.5. It's too late 
(we reached the feature freeze).

For Python 3.6, we may experiment using UTF-8 for Python filesystem encoding 
when the LC_CTYPE locale is POSIX (C).

--

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



[issue23648] PEP 475 meta issue

2015-05-25 Thread STINNER Victor

STINNER Victor added the comment:

I updated the list of modified functions in the PEP 475.

Except of the issue #23719, all other issues related to the PEP 475 have been 
fixed. It's time to close this meta issue.

--
dependencies:  -PEP 475: port test_eintr to Windows
resolution:  - fixed

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



[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Joshua Bronson

New submission from Joshua Bronson:

Is it intentional that the second assertion in the following code fails?

```
from collections import OrderedDict

d = dict(C='carbon')
o = OrderedDict(d)
assert d == o
assert d.viewitems() == o.viewitems()
```

Since d == o, I'm surprised that d.viewitems() != o.viewitems(). If that's 
intentional, I'd love to understand the rationale.

Note: I hit this while testing a library I authored, 
https://pypi.python.org/pypi/bidict, which provides a 
https://en.wikipedia.org/wiki/Bidirectional_map implementation for Python, so 
I'm especially keen to understand all the subtleties in this area.

Thanks in advance.

--
messages: 244066
nosy: jab
priority: normal
severity: normal
status: open
title: Should OrderedDict.viewitems compare equal to dict.viewitems when the 
items are equal?
versions: Python 2.7

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



[issue24254] Make class definition namespace ordered by default

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

Thanks for pointing out types.prepare_class.  I've updated it.

--

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



[issue23509] Speed up Counter operators

2015-05-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The change to __neg__ looked like a nice improvement and the same should 
technique can be done to __pos__.   Attaching a patch for those two.

--
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file39497/counter_pos_neg.diff

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



[issue23763] Chain exceptions in C

2015-05-25 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
versions: +Python 3.6

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

I've cleaned up all the ref leaks so now just the failing test_enum test 
remains to be resolved.

--

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



[issue24284] Inconsistency in startswith/endswith

2015-05-25 Thread Martin Panter

Martin Panter added the comment:

I can’t imagine much code would rely on either old or new behaviour. If you 
only put it into a feature release, would you have to document it as a change 
in behaviour?

--
nosy: +vadmium

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



[issue24284] Inconsistency in startswith/endswith

2015-05-25 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
nosy: +rhettinger

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Jim Jewett

Jim Jewett added the comment:

Eric  I realize that O (1) deletion is hard, and don't see a good way 
around it without changing the implementation ... I just think that the 
preserving the current C layout may be forcing an even more complicated 
solution than neccessary.  I am nervous about pushing this to 3.5 because of 
the complexity.  I agree that a simpler solution should (also?) wait for 3.6.

The question about dictheaher.h boils down to: if someone asks whether 
something is a dictview (not even using exact, though that isn't an option), 
an  odictview will say false ... is that really what you want?

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Yury Selivanov

Yury Selivanov added the comment:

 rather, it *is* passing now :)

Eric, thanks for working on this!  Could you please go through your patch and 
replace // comments with /* .. */ ones?  It would also be great if you can 
clean-up XXX comments.

--

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



[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow

Eric Snow added the comment:

Ah, good point.  I'll take care of all those.

--

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



[issue21998] asyncio: support fork

2015-05-25 Thread Yury Selivanov

Changes by Yury Selivanov yseliva...@gmail.com:


--
priority: normal - deferred blocker

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



[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This looks like a bug in Python 2.7:

# Python2.7
 from collections import Set
 isinstance({1:2}.viewitems(), Set)
False

# Python3.5
 from collections import Set
 isinstance({1:2}.items(), Set)
True

I think the dictitems object needs to be registered as a Set.

--

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



[issue13341] Incorrect documentation for u PyArg_Parse format unit

2015-05-25 Thread Martin Panter

Martin Panter added the comment:

The Python 3 documentation was updated in Issue 8593 (revision 5d4a5655575f). 
Perhaps some of the wording also applies to Python 2 and you can just copy it.

--
nosy: +vadmium

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



[issue24278] Docs on Parsing arguments should say something about mem mgmt for formatters returning C strings

2015-05-25 Thread Martin Panter

Martin Panter added the comment:

This is my understanding of where the buffers would be managed and what governs 
their lifetimes, though I haven’t analyzed the code to verify:

s, z: str - UTF-8 cache - pointer for object lifetime
s*, z*: str - UTF-8 cache - buffer; bytes-like - buffer; until release
y*: bytes-like - buffer until release
S: bytes borrowed object
Y: bytearray borrowed object
u, u#, Z, Z#: str - Py_UNICODE cache - pointer for object lifetime
U: str borrowed object
w*: writable bytes-like - buffer until release
es, es#: str - encoded - pointer until free (or pre-allocated for es#)
et, et#: str - encoded - pointer; bytes, bytearray - pointer; until free (or 
pre-allocated for et#)

One open question that has worried me a bit is the “s#”, “z#”, “y”, “y#” codes, 
which are documented as requiring immutable bytes-like objects, but do not 
return a buffer structure. I guess this is designed for objects like bytes(), 
where the pointer would remain valid for the object’s lifetime, even if it has 
been released according to the buffer protocol. But how is this guaranteed for 
arbitrary buffer objects? Some undocumented requirement of the buffer’s 
“readonly” flag perhaps?

So I propose to add:

* Lifetime of all Py_buffer return values is until PyBuffer_Release() is called
* Unless otherwise documented, for conversions that return pointers to buffers, 
the buffer is managed or cached inside the Python object, and the lifetime of 
that buffer is the same as the whole Python object
* Unconverted Python objects are borrowed references
* For the four immutable bytes-like conversions I mentioned that return 
pointers, the buffer management and lifetime is not documented (unless somebody 
comes up with a better explanation)

--

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



[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The fix looks something like this:

diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -473,6 +473,7 @@
 for key in self._mapping:
 yield (key, self._mapping[key])
 
+ItemsView.register(type({}.viewitems()))

Will add a more thorough patch with tests later.

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

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



[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file39502/fix_view_registry.diff

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



[issue14132] Redirect is not working correctly in urllib2

2015-05-25 Thread Martin Panter

Martin Panter added the comment:

urllib2_redirect_fix.2.patch adds a test.

I was tempted to remove the whole block of code setting the path to “/”, but 
there is one minor disadvantage: if a redirect points to a so-called 
“malformed” URL without any path component, like “http://example.net” or 
“http://example.net?query”, geturl() would return this URL verbatim.

--
stage: test needed - patch review
versions: +Python 3.6
Added file: http://bugs.python.org/file39501/urllib2_redirect_fix.2.patch

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



[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This question looks similar to:

Should list compare equal to set when the items are equal?

--
nosy: +serhiy.storchaka

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



[issue24286] Should OrderedDict.viewitems compare equal to dict.viewitems when the items are equal?

2015-05-25 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
nosy: +eric.snow

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