[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2017-01-25 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue26526] In parsermodule.c, replace over 2KLOC of hand-crafted validation code, with a DFA

2017-01-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3275d4b584a2 by Benjamin Peterson in branch '3.6':
remove comment about updating the parser module; we do not need to do that 
anymore (#26526)
https://hg.python.org/cpython/rev/3275d4b584a2

--

___
Python tracker 

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



[issue22651] Open file in a+ mode reads from end of file in Python 3.4

2017-01-25 Thread Caitlin

Caitlin added the comment:

Yeah, the workaround seemed to work for me when trying to open file on 
http://buywebsitetrafficreviews.org/, but this should be fixed somehow anyway.

--
nosy: +caitlinwalker37

___
Python tracker 

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



[issue29121] sqlite3 Controlling Transactions documentation not updated

2017-01-25 Thread Ma Lin

Ma Lin added the comment:

After read some issues, there are two major concerns:
1, backward compatibility.
2, implicit commit is bad, tolerates bug-prone codes.

However they are not contradictory if we print a warning when doing an implicit 
commit. Some messages like this:
Warning: sqlite3 module issued an implicit commit before executing VACUUM, 
you should commit this transaction by yourself, that's a good habit, etc..

Then we can keep backward compatibility, and no longer commit implicitly.

--

___
Python tracker 

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



[issue29356] TypeError by typing for Ellipsis

2017-01-25 Thread Ádám Szieberth

Ádám Szieberth added the comment:

Well, now I believe the way I suggested would conflict with other uses of 
Ellipsis in type hints.

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

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I had a local change not commited yet, so tp_fastcall-6.patch didn't get 
the [review] button. I just pushed the commit and then posted again the exact 
same patch.

--
Added file: http://bugs.python.org/file46419/tp_fastcall-6.patch

___
Python tracker 

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



[issue29358] Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation

2017-01-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8feb6a5ce4c6 by Victor Stinner in branch 'default':
Issue #29358: Add postcondition checks on types
https://hg.python.org/cpython/rev/8feb6a5ce4c6

--
nosy: +python-dev

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-25 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file46418/tp_fastcall-6.patch

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 6: type inheritance and all wrappers should now be handled 
correctly. Changes:

* Add fastwrapper to wrapperbase structure
* Add d_use_fastwrapper to PyWrapperDescrObject structure
* wrapper_call() uses fast call
* Protect access to tp_fastcall with Py_TPFLAGS_HAVE_FASTCALL in all cases
* _Py_RawFastCallDict() doesn't check the result anymore, it's now checked in 
the caller: self can be NULL for static methods (try test_bytes unit test!)
* Fix type inheritance: update_one_slot() now makes sure that tp_call and 
tp_fastcall are synchronize. Before, the update was done after but not in all 
cases.
* Fix fastcall_wrapper() to support "StaticType.tp_call(obj, ...);" calls: 
Py_TYPE(obj)->tp_fastcall can be NULL, we have to search non-NULL tp_fastcall 
in base classes in this case.

IMHO the most tricky parts of the change are in update_one_slot() and 
add_operators().

Many fixes were "backported" from my work on the issue #29358 (tp_fastnew and 
tp_fastinit). Technically, I cherry-picked commits and fixes all the merge 
conflicts.

It may be worth to use FASTCALL in more wrappers (wrap_xxx functions in 
typeobject.c) of slotdefs.

--
Added file: http://bugs.python.org/file46418/tp_fastcall-6.patch

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

INADA Naoki added the comment:

Thanks, Serhiy.  You're right.

--
status: open -> closed

___
Python tracker 

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



[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also similar issue with scrapy: 
https://github.com/scrapy-plugins/scrapy-djangoitem/issues/18.

--

___
Python tracker 

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



[issue29375] httplib: wrong Host header when connecting to IPv6 link-local address

2017-01-25 Thread Martin Panter

Martin Panter added the comment:

More closely related: Issue 23448, about the same thing with urllib, which adds 
the Host value itself. Any solution should be shared between both modules.

--
nosy: +martin.panter

___
Python tracker 

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



[issue29376] threading._DummyThread.__repr__ raises AssertionError

2017-01-25 Thread Tom Myers

New submission from Tom Myers:

_DummyThread objects have _is_stopped = False, but _tstate_lock = None.  This 
causes an AssertionError in is_alive and __repr__ .

  File ".../cp34/lib/python3.4/threading.py", line 814, in __repr__
self.is_alive() # easy way to get ._is_stopped set when appropriate
  File ".../cp34/lib/python3.4/threading.py", line 1110, in is_alive
self._wait_for_tstate_lock(False)
  File ".../cp34/lib/python3.4/threading.py", line 1066, in 
_wait_for_tstate_lock
assert self._is_stopped
AssertionError

--
components: Library (Lib)
messages: 286285
nosy: Tom Myers
priority: normal
severity: normal
status: open
title: threading._DummyThread.__repr__ raises AssertionError
versions: Python 3.4

___
Python tracker 

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



[issue29374] Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the Main thread

2017-01-25 Thread Martin Panter

Martin Panter added the comment:

This works for me on Linux:

>>> signal.pthread_sigmask(signal.SIG_BLOCK, {signal.SIGUSR1})
set()
>>> import threading
>>> t = threading.Thread(target=sigwait)
>>> t.start()
Send me a signal, my PID is 24197
>>> os.kill(os.getpid(), signal.SIGUSR1)
Got the signal: 10
>>> t.join()

Posix  
only defines sigwait() if the signals are already blocked. Two reasons behind 
this come to mind:

1. There would be a race where the signal handler may be called first (or the 
signal may be ignored) at the OS level, and the sigwait() function will miss 
the signal and block.

2. If the signal is handled in the context of another thread that isn’t using 
sigwait(), it may be consumed (handled or ignored) in the context of the other 
thread, with no effect on your sigwait() call.

This detail of blocking the signal seems to be a common error, so maybe the 
Python documentation could help point it out. (Issue 25868 comes to mind; there 
is a test case that IMO should block a signal before waiting for it.)

--
nosy: +martin.panter
versions:  -Python 3.4

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-01-25 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

OK, cool. So, long term, there will be a way to do this (suspend within a 
generator expression). Thanks for the pointer.

--

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-01-25 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

(As far as awaiting on int, yes, I know how await works, I was focusing on the 
syntax.)

--

___
Python tracker 

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



[issue23448] urllib2 needs to remove scope from IPv6 address when creating Host header

2017-01-25 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-01-25 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Python 3.5 does not support this, you should use Python 3.6 (plus await x will 
fail when you will run the coroutine, since you cannot await on int).

--

___
Python tracker 

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



[issue27500] ProactorEventLoop cannot open connection to ::1

2017-01-25 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue25667] Supply dual-stack (IPv4/IPv6) socket bind routine

2017-01-25 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue24209] Allow IPv6 bind in http.server

2017-01-25 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue29375] httplib: wrong Host header when connecting to IPv6 link-local address

2017-01-25 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-01-25 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

>>> async def foo():
... bar = [await x for x in range(10)]
  File "", line 2
SyntaxError: 'await' expressions in comprehensions are not supported

--

___
Python tracker 

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



[issue29370] "./configure --enable-optimizations && make install" does not install files in ${BINDIR} and ${LIBDIR}

2017-01-25 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue29375] httplib: wrong Host header when connecting to IPv6 link-local address

2017-01-25 Thread Martin Panter

Changes by Martin Panter :


--
components: +Library (Lib)
stage:  -> needs patch
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



[issue29236] 'an ASCII string of one or more PEM-encoded certificates' needs to be unicode

2017-01-25 Thread Michael Kleehammer

Changes by Michael Kleehammer :


--
nosy: +mkleehammer

___
Python tracker 

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



[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-25 Thread Eryk Sun

Eryk Sun added the comment:

Python appends "\*.*" to the path, so in the case in which the leaf element is 
a file, FindFirstFile naturally fails with ERROR_PATH_NOT_FOUND.

Python 3.5+ could maybe switch to calling CreateFile to open a handle and 
GetFileInformationByHandleEx to get the FILE_ID_BOTH_DIR_INFO (added in Vista, 
so this couldn't be backported to 2.7). It would first have to get the 
FILE_BASIC_INFO for the file attributes to ensure that the target is a 
directory. This could also support listing directories by file descriptor on 
Windows, since the CRT has O_OBTAIN_DIR (0x2000) for opening a directory.

--
nosy: +eryksun

___
Python tracker 

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



[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Blame Windows for this behavior. os.listdir() is just a wrapper around few 
system calls.

It is expected that functions in the os module can raise different exceptions 
on different platforms.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29028] Use-After-Free in PyString_FromStringAndSize() of stringobject.c

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch fixes the issue. But it is hard to write a reliable patch.

--
Added file: http://bugs.python.org/file46417/buffer-use-after-free-3.patch

___
Python tracker 

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



[issue29375] httplib: wrong Host header when connecting to IPv6 link-local address

2017-01-25 Thread Jonathan Guthrie

New submission from Jonathan Guthrie:

This is related to issue 5111.

An IPv6 link-local address must include a scope specifier as part of the 
address passed to the HTTPConnection or HTTPSConnection constructor, that scope 
specifier is not being stripped from the address passed in the HTTP 1.1 Host: 
header line.

So, suppose I was attempting to connect to an HTTP server on 
fe80::8aae:1dff:fea4:29c8.  That's a link-local address, so I must give the 
scope specifier, which is the interface I can use to connect to that address.  
So, the address I would pass to the HTTPConnection constructor might look like 
"fe80::8aae:1dff:fea4:29c8%eth0".  The appropriate Host line in the HTTP 
request would be "Host: [fe80::8aae:1dff:fea4:29c8]" but it is actually "Host: 
[fe80::8aae:1dff:fea4:29c8%eth0]"

Compliant HTTP servers reject requests including this line as malformed.

--
messages: 286276
nosy: JonathanGuthrie
priority: normal
severity: normal
status: open
title: httplib: wrong Host header when connecting to IPv6 link-local address
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-25 Thread raylu

raylu added the comment:

os.listdir should always return NotADirectoryError when run on a regular file. 
Users shouldn't have to special-case win32/FileNotFoundError.

--

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-01-25 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

> Is the fact that 'await' produces a syntax error in this context the same bug 
> or a new one?

What kind of SyntaxError? await outside an async function is prohibited, bare 
await is also prohibited.

--

___
Python tracker 

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



[issue10544] yield expression inside generator expression does nothing

2017-01-25 Thread Glyph Lefkowitz

Glyph Lefkowitz added the comment:

Is the fact that 'await' produces a syntax error in this context the same bug 
or a new one?

--
nosy: +glyph

___
Python tracker 

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



[issue29372] RotatingFileHandler rotates empty logfile if it emits a large string

2017-01-25 Thread Vinay Sajip

Vinay Sajip added the comment:

I don't see the point - your proposed solution only works if the log file is 
completely empty at rollover time, but if the file contains a few bytes from an 
earlier "short" log message, it might seem just as wasteful of a backup slot as 
if it had zero bytes. I think the understanding is that maxBytes should be 
large compared to the size of an average log message, and that if that isn't 
the case, the user will live with the consequences because it's a contrived 
scenario (for tests, etc.) rather than a real-life one. There's always the 
option of subclassing if a user really does need bespoke rollover behaviour.

--

___
Python tracker 

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



[issue29358] Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

I implemented more optimizations:

* type_call() uses FASTCALL
* object_new() and object_init() use FASTCALL
* _asyncio.Future new & init use FASTCALL

As a result, create an _asyncio.Future is now 1.45x faster:

haypo@smithers$ ./python -m perf timeit -s 'import _asyncio, asyncio; 
Future=_asyncio.Future; loop=asyncio.get_event_loop()' 'Future(loop=loop)' 
--compare-to=../default-ref/python 
Median +- std dev: [ref] 411 ns +- 8 ns -> [fast_init] 283 ns +- 10 ns: 1.45x 
faster (-31%)


Yury> Great. Can you share the Richards benchmark results?  It specifically 
stresses class instantiation, so we should be able to see the improvement.

While bm_richards.py doesn't call _PyStack_AsTuple() anyone in the benchmark 
(it seems like it full uses FASTCALL), it seems like there is simply zero 
impact on performance :-(

$ ./python -m perf compare_to richards_ref.json richards_fastinit.json 
Benchmark hidden because not significant (1): richards

--

___
Python tracker 

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



[issue29373] subprocess.Popen os.close(p2cread) in _execute_child can cause garbage collection of self.stdout to close a reused file descriptor

2017-01-25 Thread Zac Medico

Zac Medico added the comment:

Actually, os.close(p2cread) closes a different file descriptor than c2pread, so 
my analysis is not correct. I don't know the precise cause of the EBADF error 
that I have observed. I suppose it could be some other code closing a file 
descriptor that belongs to a file object. Closing for now. Sorry for the noise.

I will follow up on the issue here:

https://bugs.gentoo.org/show_bug.cgi?id=582098

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



[issue29374] Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the Main thread

2017-01-25 Thread Petr MOTEJLEK

New submission from Petr MOTEJLEK:

Hi,

The documentation for signal.signal() clearly states that it is only supposed 
to be called on MainThread

However, it does not say so for the signal.sigwait() and neither 
signal.sigtimedwait()

I think this is an error on the documentation side of things (unless I misread 
it). When either signal.sigwait or signal.sigtimedwait are called outside 
MainThread, they simply never catch any signals (signal.sigwait blocks 
indefinitely)

I did not test this on Windows, but on both Linux and OS X the behavior is the 
same

Consider the below simple code

  import signal
  import os
  def sigwait():
print("Send me a signal, my PID is {p}".format(p=os.getpid()))  
print("Got the signal: {i}".format(i=signal.sigwait((signal.SIGUSR1,

If sigwait() is called on MainThread and the process receives SIGUSR1, "Got the 
signal: ..." gets printed. However, calling sigwait in a different thread 
blocks the thread indefinitely. The behavior is the same with 
signal.sigtimedwait() as well

--
assignee: docs@python
components: Documentation
messages: 286269
nosy: docs@python, p...@motejlek.net
priority: normal
severity: normal
status: open
title: Doc bug: signal.sigwait and signal.sigtimedwait do not work outside the 
Main thread
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29373] subprocess.Popen os.close(p2cread) in _execute_child can cause garbage collection of self.stdout to close a reused file descriptor

2017-01-25 Thread Zac Medico

New submission from Zac Medico:

In Popen _execute_child method, os.close(p2cread) closes a file descriptor 
which is referenced by self.stdout with closefd=True, created by this code:

   self.stdout = io.open(c2pread, 'rb', bufsize)

When self.stdout is finally garbage collected, it can close a file descriptor 
which has been reused since the os.close(p2cread) call. In the rare cases when 
this happens, it results in a traceback like the following:

Traceback (most recent call last):
  File "/usr/lib64/python3.4/subprocess.py", line 1418, in _execute_child
part = _eintr_retry_call(os.read, errpipe_read, 5)
  File "/usr/lib64/python3.4/subprocess.py", line 491, in _eintr_retry_call
return func(*args)
OSError: [Errno 9] Bad file descriptor

I have observed this issue with python 3.4.5, and the code flaw also appears to 
be present in 3.5, 3.6, and 3.7. This sort of garbage collection issue has been 
highlighted in the first comment of http://bugs.python.org/issue16140, but 
there is still a remaining problem with this os.close(p2cread) call.

--
messages: 286268
nosy: zmedico
priority: normal
severity: normal
status: open
title: subprocess.Popen os.close(p2cread) in _execute_child can cause garbage 
collection of self.stdout to close a reused file descriptor
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think additional checks are not needed. PyObject_CallFunction() allows 
passing NULLs.

--

___
Python tracker 

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



[issue13285] signal module ignores external signal changes

2017-01-25 Thread Thomas Kluyver

Thomas Kluyver added the comment:

I pitched both the opaque handle and the context manager to python-ideas, but 
didn't get any responses, positive or negative.

--

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2017-01-25 Thread Michael Haubenwallner

Changes by Michael Haubenwallner :


--
nosy: +haubi

___
Python tracker 

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



[issue29372] RotatingFileHandler rotates empty logfile if it emits a large string

2017-01-25 Thread Lee Griffiths

New submission from Lee Griffiths:

If you write a really big string to an empty file, and that string is > 
maxBytes, then `RotatingFileHandler` (or even `BaseRotatingHandler`) will roll 
that empty file into the backup queue.

I think it should instead use that empty file for the mega-string. By not doing 
so it "wastes" a slot in the backup queue.

It's a very minor issue: I doubt it really happens IRL, but I noticed it when 
extending RotatingFileHandler in py2.7 to add gzip stuff and my test cases used 
a really small size (16 bytes!)


Here's a test file:

#!/usr/bin/env python3
# coding=utf-8

import logging
import os
import tempfile

from logging.handlers import RotatingFileHandler


class MockRecord(object):
def __init__(self, msg):
self.msg = msg
self.stack_info = None
self.exc_info = None
self.exc_text = None

def getMessage(self):
return self.msg


def test_file_rollover_from_mega_string(temp_dir_path):
# This is a pretty weird test.
# It tests that writing a huge string to a blank file causes the blank
# file to be archived and the huge string written to the next log file.
#
# Normally the log files would have a large max bytes so we'd have to
# be writing a giant string to an empty file for this to happen.
# But, even if it does, it's what BaseRotatingHandler does, so...

log_path = os.path.join(temp_dir_path, "mylog.log")

handler = RotatingFileHandler(log_path, maxBytes=16, backupCount=5)
handler.setFormatter(logging.Formatter())
with open(log_path) as log:
assert log.read() == ""

# --
handler.emit(MockRecord("There once was a test from bitbucket"))
with open(log_path) as log:
log_read = log.read()
assert log_read == "There once was a test from bitbucket\n"

with open(log_path + ".1") as log:
log_read = log.read()
assert log_read == ""

# --
handler.emit(MockRecord("11 chars"))
with open(log_path) as log:
log_read = log.read()
assert log_read == "11 chars\n"

with open(log_path + ".1") as log:
log_read = log.read()
assert log_read == "There once was a test from bitbucket\n"

with open(log_path + ".2") as log:
log_read = log.read()
assert log_read == ""

handler.close()


test_file_rollover_from_mega_string(tempfile.mkdtemp())


and here's a patch that I think will fix it:

~/src/others/cpython (master *%=)$ cat empty_rollover.patch 
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 7d77973..0dabfd7 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -186,7 +186,11 @@ class RotatingFileHandler(BaseRotatingHandler):
 if self.maxBytes > 0:   # are we rolling over?
 msg = "%s\n" % self.format(record)
 self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
-if self.stream.tell() + len(msg) >= self.maxBytes:
+size = self.stream.tell()
+if size == 0:
+# No point rolling-over an empty file
+return 0
+elif size + len(msg) >= self.maxBytes:
 return 1
 return 0

--
components: Library (Lib)
messages: 286265
nosy: Poddster, vinay.sajip
priority: normal
severity: normal
status: open
title: RotatingFileHandler rotates empty logfile if it emits a large string
type: resource usage
versions: Python 2.7, Python 3.7

___
Python tracker 

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



[issue13285] signal module ignores external signal changes

2017-01-25 Thread Jeroen Demeyer

Jeroen Demeyer added the comment:

Let me add that this "low-level opaque object" would be rather easy to 
implement on POSIX systems (I have no clue about other systems such as 
Windows). I could implement it, but it would be good to have some pre-approval 
from Python devs that it's a good idea to do this.

--
nosy: +jdemeyer

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

"We use Flask. Flask is based on Werkzeug. Werkzeug imports inspect. inspect 
imports ast. ast imports _ast."

Oh, this was unexpected to me :-)

--

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

INADA Naoki added the comment:

> You should check if _PyUnicode_FromId() returns NULL if it was the first call 
> and the UTF-8 decode failed to allocate memory.

thanks. new patch will fix it.

> You might initialize all these identifiers (and check for errors) in 
> init_types() to avoid having to check for errors each time they are used.

Here is not so performance critical part.

> But the _ast module is not imported by default, only in programs importing 
> "ast" explicitly.
> Well, I'm not opposed to the change, I'm just trying to understand how the 
> code is used ;-)

We use Flask. Flask is based on Werkzeug. Werkzeug imports inspect.
inspect imports ast. ast imports _ast.

--
Added file: http://bugs.python.org/file46416/ast-identifier4.patch

___
Python tracker 

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



[issue26526] In parsermodule.c, replace over 2KLOC of hand-crafted validation code, with a DFA

2017-01-25 Thread A. Skrobov

A. Skrobov added the comment:

Oh btw, the comment in the beginning of Grammar/Grammar

> # Note:  Changing the grammar specified in this file will most likely
> #require corresponding changes in the parser module
> #(../Modules/parsermodule.c).

is no longer true: after this patch went in, changing the grammar no longer 
requires translating the changes into Modules/parsermodule.c

Can somebody please remove the obsolete comment from there?

--

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

> The three identifiers are used in type.  Dozen (100+) types using them.

I tried once to put *all* (most common) _Py_IDENTIFIER() in a single file and 
share them, but I abandoned my attempt:

http://bugs.python.org/issue19515#msg202385
Antoine Pitrou: "Well, then IMHO it's not worth it."

See issues #19512 and #19515.


"""
>>> import _ast
>>> _ast.Dict.__dict__
mappingproxy({'_fields': ('keys', 'values'), '__module__': '_ast', '__doc__': 
None})
"""

But the _ast module is not imported by default, only in programs importing 
"ast" explicitly.

Well, I'm not opposed to the change, I'm just trying to understand how the code 
is used ;-)

--

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

+result = PyObject_CallFunction((PyObject*)_Type, "s(O){}",
+type, base,
+_PyUnicode_FromId(__fields), fnames,
+_PyUnicode_FromId(___module__),
+_PyUnicode_FromId(__ast));

You should check if _PyUnicode_FromId() returns NULL if it was the first call 
and the UTF-8 decode failed to allocate memory.

You might initialize all these identifiers (and check for errors) in 
init_types() to avoid having to check for errors each time they are used.

--

___
Python tracker 

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



[issue29366] os.listdir has inconsistent behavior when run on a non-directory

2017-01-25 Thread R. David Murray

R. David Murray added the comment:

Could you please clarify what bug you are reporting?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue29371] Typo in doctest documentation

2017-01-25 Thread Marco Buttu

Marco Buttu added the comment:

What about this?

"Symbolic names for the flags are supplied as module constants, which can be 
OR'ed together (flagA | flagB | ...) and passed to various functions."

--

___
Python tracker 

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



[issue29371] Typo in doctest documentation

2017-01-25 Thread Marco Buttu

Marco Buttu added the comment:

I think you got the meaning. I have never read it before :/ If you think the 
meaning is clear enough for everyone, I close the issue.

--

___
Python tracker 

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



[issue29371] Typo in doctest documentation

2017-01-25 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

>From what I understand, "or'ed" here stands for combining the options using 
>`|` 
>(https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations).

You can see an example of that in the source for `doctest.py` 
https://hg.python.org/cpython/file/3.6/Lib/doctest.py#l144

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue29371] Typo in doctest documentation

2017-01-25 Thread Marco Buttu

New submission from Marco Buttu:

>From the doctest documentation [1]:

"Symbolic names for the flags are supplied as module constants, which can be 
or'ed together and passed to various functions."

Is there a typo in "...which can be or'ed together..."? Maybe "collected 
together"?


[1] https://docs.python.org/3/library/doctest.html#option-flags

--
assignee: docs@python
components: Documentation
messages: 286254
nosy: docs@python, marco.buttu
priority: normal
severity: normal
status: open
title: Typo in doctest documentation
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

Changes by INADA Naoki :


--
resolution:  -> fixed

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a507882736b2 by INADA Naoki in branch 'default':
Issue #29369: Use Py_IDENTIFIER in Python-ast.c
https://hg.python.org/cpython/rev/a507882736b2

--
nosy: +python-dev

___
Python tracker 

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



[issue29333] ConfigParser calls Interpolation.before_read after reading

2017-01-25 Thread Gereon Kaiping

Changes by Gereon Kaiping :


--
components: +Library (Lib)
type:  -> behavior
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

INADA Naoki added the comment:

> AST objects are supposed to be temporary. Interning strings used in the AST 
> processor would make these strings immortal and so increase the memory usage, 
> no?
> What is the purpose of the patch? Speedup or reduce the memory usage?

The three identifiers are used in type.  Dozen (100+) types using them.

>>> import _ast
>>> _ast.Dict.__dict__
mappingproxy({'_fields': ('keys', 'values'), '__module__': '_ast', '__doc__': 
None})
>>> _ast.DictComp.__dict__
mappingproxy({'_fields': ('key', 'value', 'generators'), '__module__': '_ast', 
'__doc__': None})


Each string uses about 50 bytes. So 50 * 3 * 100 = 15KB may be reduced.

But main purpose is less noise when looking memory usage of Python.

--

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. _Py_IDENTIFIER is private API, but is not new in Python-ast.c.

I expect insignificant speedup and reduce the memory usage from the patch.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29368] Optimize unpickling list-like objects: use extend() instead of append()

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See issue17720 for a feedback from Alexandre.

--

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

> While I'm looking Python's memory usage, I found some dicts which key is not 
> interned "_fields", "_ast" and "__modules__".

AST objects are supposed to be temporary. Interning strings used in the AST 
processor would make these strings immortal and so increase the memory usage, 
no?

What is the purpose of the patch? Speedup or reduce the memory usage?

--

___
Python tracker 

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



[issue29368] Optimize unpickling list-like objects

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

> Every object that return listitems from the __reduce__() method must support 
> the extend() method according to the specification.

Hum ok. I don't know well the pickle module, but according to your quote, yeah, 
the patch is valid.

pickle-appends-extend.patch LGTM, except minor comments.

It would be nice to get a feedback from Alexandre, but I'm not sure that he is 
still around :-/

What about Antoine Pitrou, are you around? :-)

--
nosy: +pitrou

___
Python tracker 

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



[issue29368] Optimize unpickling list-like objects: use extend() instead of append()

2017-01-25 Thread STINNER Victor

Changes by STINNER Victor :


--
title: Optimize unpickling list-like objects -> Optimize unpickling list-like 
objects: use extend() instead of append()

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

Changes by INADA Naoki :


Removed file: http://bugs.python.org/file46414/ast-identifier2.patch

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file46415/ast-identifier3.patch

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file46414/ast-identifier2.patch

___
Python tracker 

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



[issue29370] "./configure --enable-optimizations && make install" does not install files in ${BINDIR} and ${LIBDIR}

2017-01-25 Thread Дилян Палаузов

New submission from Дилян Палаузов:

With Python 3.5.3 "./configure --enable-shared && make install 
DESTDIR=/tmp/ZZ1" does install files in /tmp/ZZ1/usr/local/bin/ and 
/tmp/ZZ1/usr/local/bin/ .

"./configure --enable-optimizations --enable-shared && make install 
DESTDIR=/tmp/ZZ2" does not install files in /tmp/ZZ2/usr/local/bin/ and 
/tmp/ZZ2/usr/local/bin/ .

--
components: Installation
messages: 286247
nosy: dilyan.palauzov
priority: normal
severity: normal
status: open
title: "./configure --enable-optimizations && make install" does not install 
files in ${BINDIR} and ${LIBDIR}
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

Python/Python-ast.c started with:

/* File automatically generated by Parser/asdl_c.py. */

Please fix the generator, not the generated file ;-)

--
nosy: +haypo

___
Python tracker 

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



[issue29336] merge tuples in module

2017-01-25 Thread INADA Naoki

INADA Naoki added the comment:

As I said on ML, now I think embedding some co_* tuples into code object
is better way to reduce number of tuples and memory usage.
So I close this issue for now.

Thanks for review and comments.

--
resolution:  -> postponed
status: open -> pending

___
Python tracker 

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



[issue29369] Use Py_IDENTIFIER in Python-ast.c

2017-01-25 Thread INADA Naoki

New submission from INADA Naoki:

While I'm looking Python's memory usage, I found some dicts which key
is not interned "_fields", "_ast" and "__modules__".

--
components: Interpreter Core
files: ast-identifier.patch
keywords: patch
messages: 286244
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Use Py_IDENTIFIER in Python-ast.c
versions: Python 3.7
Added file: http://bugs.python.org/file46413/ast-identifier.patch

___
Python tracker 

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



[issue29368] Optimize unpickling list-like objects

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

collections.Sequence has no relation to the pickle protocol.

Every object that return listitems from the __reduce__() method must support 
the extend() method according to the specification.

--

___
Python tracker 

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



[issue29368] Optimize unpickling list-like objects

2017-01-25 Thread STINNER Victor

STINNER Victor added the comment:

What is the cost of adding an extra isinstance(d, collections.Sequence) check? 
It would be closer the current design ("white list" of types), safer and avoid 
bad surprises.

But Python has a long tradition of duck typing, so maybe isinstance() can be 
seen as overkill :-)

--
nosy: +haypo

___
Python tracker 

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



[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-01-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d5590f357d74 by Serhiy Storchaka in branch '2.7':
Issue #27867: Replaced function PySlice_GetIndicesEx() with a macro.
https://hg.python.org/cpython/rev/d5590f357d74

New changeset 96f5327f7253 by Serhiy Storchaka in branch '3.5':
Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro if
https://hg.python.org/cpython/rev/96f5327f7253

New changeset b4457fe7fdb8 by Serhiy Storchaka in branch '3.6':
Issue #27867: Function PySlice_GetIndicesEx() is replaced with a macro if
https://hg.python.org/cpython/rev/b4457fe7fdb8

New changeset 6093ce8eed6c by Serhiy Storchaka in branch 'default':
Issue #27867: Function PySlice_GetIndicesEx() is deprecated and replaced with
https://hg.python.org/cpython/rev/6093ce8eed6c

--
nosy: +python-dev

___
Python tracker 

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



[issue29182] Remove the warning in urllib docs that it doesn't do certificate validate by default.

2017-01-25 Thread Julian Berman

Julian Berman added the comment:

The change note belongs outside the seealso.

I think also that wasn't exactly what Martin had in mind, I think he meant a 
`.. versionchanged` directive -- and given that this was originally a warning, 
personally I'd leave the warning but reword it, it's still relevant for 
pre-2.7.9 users.

E.g. something like:

.. seealso::

   

.. versionchanged:: 2.7.9

HTTPS certificates now have hostname verification enabled by default.

.. warning::

Versions prior to 2.7.9 do not safely verify hostnames. It is not 
recommended to use this module on these versions -- the aformentioned requests 
module can be used instead.

Or the like.

--
nosy: +Julian

___
Python tracker 

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



[issue29136] Add OP_NO_TLSv1_3

2017-01-25 Thread Cory Benfield

Cory Benfield added the comment:

For those who want to keep track, the relevant OpenSSL ticket for configuring 
TLSv1.3 cipher suites is https://github.com/openssl/openssl/issues/2276.

--
nosy: +Lukasa

___
Python tracker 

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



[issue29083] Readd PyArg_VaParse to the stable API

2017-01-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue29368] Optimize unpickling list-like objects

2017-01-25 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

According to PEP 307 the extend method can be used for appending list items to 
the object.

listitemsOptional, and new in this PEP.
 If this is not None, it should be an iterator (not a
 sequence!) yielding successive list items.  These list
 items will be pickled, and appended to the object using
 either obj.append(item) or obj.extend(list_of_items).
 This is primarily used for list subclasses, but may
 be used by other classes as long as they have append()
 and extend() methods with the appropriate signature.
 (Whether append() or extend() is used depends on which
 pickle protocol version is used as well as the number
 of items to append, so both must be supported.)

Proposed patch makes the extend method be used in the APPENDS opcode. To avoid 
breaking existing code the use of the extend method is optional.

Microbenchmark:

$ ./python -m timeit -s "import pickle, collections; p = 
pickle.dumps(collections.deque([None]*1), 4)" -- "pickle.loads(p)"
Unpatched:  100 loops, best of 5: 2.02 msec per loop
Patched:500 loops, best of 5: 833 usec per loop

--
components: Library (Lib)
files: pickle-appends-extend.patch
keywords: patch
messages: 286237
nosy: alexandre.vassalotti, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Optimize unpickling list-like objects
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46412/pickle-appends-extend.patch

___
Python tracker 

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



[issue17720] pickle.py's load_appends should call append() on objects other than lists

2017-01-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks. Opened issue29368 for this.

--
status: open -> closed

___
Python tracker 

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



[issue26149] Suggest PyCharm Community as an editor for Unix platforms

2017-01-25 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thank you, Mariatta.

--
nosy: +orsenthil
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue26149] Suggest PyCharm Community as an editor for Unix platforms

2017-01-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 25fc68e22eee by Senthil Kumaran in branch '3.6':
issue26149 - Point to Wiki for Editors and Python IDEs on Unix.
https://hg.python.org/cpython/rev/25fc68e22eee

New changeset 0fd4a3d8e32a by Senthil Kumaran in branch 'default':
[merge 3.6] - issue26149 - Point to Wiki for Editors and Python IDEs on Unix.
https://hg.python.org/cpython/rev/0fd4a3d8e32a

--

___
Python tracker 

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



[issue26149] Suggest PyCharm Community as an editor for Unix platforms

2017-01-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b43e270648a3 by Senthil Kumaran in branch '2.7':
issue26149 - Point to Wiki for Editors and Python IDEs on Unix.
https://hg.python.org/cpython/rev/b43e270648a3

--
nosy: +python-dev

___
Python tracker 

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



[issue29367] python-gdb: display wrapper_call()

2017-01-25 Thread STINNER Victor

New submission from STINNER Victor:

python-gdb.py handles various Python calls, but not descriptors. Attached patch 
adds code to display calls to wrapperobject objects.

The patch adds the first "" line of the traceback:
---
(gdb) py-bt
Traceback (most recent call first):
  
  File "/home/haypo/prog/python/git_cpython/Lib/encodings/utf_8.py", line 41, 
in getregentry
streamwriter=StreamWriter,
  File "/home/haypo/prog/python/git_cpython/Lib/encodings/__init__.py", line 
122, in search_function
entry = getregentry()
---

I wrote this patch while working on the issue #29358. Object instanciation is 
full of wrappers. A better debugger helps to me understand my bugs ;-)

Example to get such tracecback:
---
haypo@selma$ gdb -args ./python -m test -v test_sys
(gdb) b wrapper_call
(gdb) run
(gdb) py-bt
Traceback (most recent call first):
  
  File "/home/haypo/prog/python/default/Lib/enum.py", line 66, in __init__
super().__init__()
  File "/home/haypo/prog/python/default/Lib/enum.py", line 117, in __prepare__
enum_dict = _EnumDict()
  
  File "/home/haypo/prog/python/default/Lib/enum.py", line 509, in 
class Enum(metaclass=EnumMeta):
  
  File "", line 205, in _call_with_frames_removed
  (...)
---

I guess that the next step is to write a test ;-)

--
files: gdb_wrapper_call.patch
keywords: patch
messages: 286233
nosy: haypo, inada.naoki
priority: normal
severity: normal
status: open
title: python-gdb: display wrapper_call()
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46411/gdb_wrapper_call.patch

___
Python tracker 

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



[issue29310] Document typing.NamedTuple default argument syntax

2017-01-25 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Thank you for the patch! I added few comments.

--
stage:  -> patch review

___
Python tracker 

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