Sworddragon | 19 Sep 16:08 2014

[issue22443] read(1) blocks on unflushed output


New submission from Sworddragon:

On reading the output of an application (for example "apt-get download firefox") that dynamically
changes a line (possibly with the terminal control character \r) I have noticed that read(1) does not read
the output until it has finished with a newline. This happens even with disabled buffering. In the
attachments is a testcase for this problem. Also here are 2 screenshots to compare the results:

Direct call: http://picload.org/image/crldgri/normal.png
Subprocess: http://picload.org/image/crldgrw/subprocess.png

----------
components: Library (Lib)
files: test.py
messages: 227097
nosy: Sworddragon
priority: normal
severity: normal
status: open
title: read(1) blocks on unflushed output
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file36661/test.py

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22443>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
(Continue reading)

juj | 19 Sep 15:56 2014

[issue22442] subprocess.check_call hangs on large PIPEd data.


New submission from juj:

On Windows, write

a.py:

import subprocess

def ccall(cmdline, stdout, stderr):
  proc = subprocess.Popen(['python', 'b.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  proc.communicate()
  if proc.returncode != 0: raise subprocess.CalledProcessError(proc.returncode, cmdline)
  return 0

# To fix subprocess.check_call, uncomment the following, which is functionally equivalent:
# subprocess.check_call = ccall

subprocess.check_call(['python', 'b.py'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print 'Finished!'

Then write b.py:

import sys

str = 'aaa'
for i in range(0,16): str = str + str
for i in range(0,2): print >> sys.stderr, str
for i in range(0,2): print str

(Continue reading)

Sworddragon | 19 Sep 14:27 2014

[issue22441] Not all attributes of the console for a subprocess with creationflags=0 are inherited


New submission from Sworddragon:

The application apt-get on Linux does scale its output dependent of the size of the terminal but I have
noticed that there are differences if I'm calling apt-get directly or with a subprocess without shell and
creationflags set (so that creationflags should be 0). From the documentation
subprocess.CREATE_NEW_CONSOLE is not set so that apt-get does inherit the console and normally I would
assume that this counts also for all attributes. In the attachments is a testcase for this issue. Also here
are 2 screenshots to compare the results:

Direct call: http://picload.org/image/crlrapg/normal.png
Subprocess: http://picload.org/image/crlrapd/subprocess.png

----------
components: Library (Lib)
files: test.py
messages: 227090
nosy: Sworddragon
priority: normal
severity: normal
status: open
title: Not all attributes of the console for a subprocess with creationflags=0 are inherited
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file36660/test.py

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22441>
_______________________________________
(Continue reading)

Senthil Kumaran | 19 Sep 09:53 2014

[issue22440] Setting SSLContext object's check_hostname manually might accidentally skip hostname verification


New submission from Senthil Kumaran:

While working on issue22366, I found a tricky bit of code in:

https://hg.python.org/cpython/file/ca0aa0d89273/Lib/http/client.py#l1295
https://hg.python.org/cpython/rev/1a945fb875bf/

The statement is

 if not self._context.check_hostname and self._check_hostname:

The context object's check_hostname (created by ssl._create_stdlib_context() -
note private ) is False by default and the statement holds good and acts only on
self._check_hostname

But if the context is constructed manually and the context object's
check_hostname is set to True (with correct intentions), that statement will
lead to skipping of matching hostname!

Is my analysis right here?

----------
messages: 227082
nosy: alex, christian.heimes, dstufft, orsenthil, pitrou
priority: normal
severity: normal
status: open
title: Setting SSLContext object's check_hostname manually might accidentally skip hostname verification
versions: Python 3.4, Python 3.5
(Continue reading)

Sworddragon | 19 Sep 01:33 2014

[issue22439] subprocess.PIPE.stdin.flush() causes to hang while subprocess.PIPE.stdin.close() not


New submission from Sworddragon:

On sending something to stdin of a process that was called with subprocess (for example diff) I have figured
out that all is working fine if stdin is closed but flushing stdin will cause a hang (the same as nothing
would be done). In the attachments is a testcase that shows this problem. If executed the application will
hang but if #pipe.stdin.close() will be uncommented (and optionally pipe.stdin.flush() commented
out) all is working fine.

----------
components: Library (Lib)
files: test.py
messages: 227076
nosy: Sworddragon
priority: normal
severity: normal
status: open
title: subprocess.PIPE.stdin.flush() causes to hang while subprocess.PIPE.stdin.close() not
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file36655/test.py

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22439>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

(Continue reading)

Alex Gaynor | 18 Sep 23:21 2014

[issue22438] eventlet broke by python 2.7.x


New submission from Alex Gaynor:

https://github.com/eventlet/eventlet/issues/135

----------
components: Library (Lib)
messages: 227067
nosy: alex, benjamin.peterson, christian.heimes, dstufft, giampaolo.rodola, janssen, pitrou
priority: normal
severity: normal
status: open
title: eventlet broke by python 2.7.x
versions: Python 2.7

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22438>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Yury Selivanov | 18 Sep 19:39 2014

[issue22437] re module: number of named groups is limited to 100 max


New submission from Yury Selivanov:

While writing a lexer for javascript language, I managed to hit the limit of named groups in one regexp, it's
100.  The check is in sre_compile.py:compile() function, and there is even an XXX comment on this.

Unfortunately, I'm not an expert in this module, so I'm not sure if this check can be lifted, or at least if the
number can be bumped to 200 or 500 (why is 100 btw?)

Please share your thoughts.

----------
components: Library (Lib), Regular Expressions
messages: 227055
nosy: ezio.melotti, haypo, mrabarnett, pitrou, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: re module: number of named groups is limited to 100 max
type: enhancement

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22437>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

(Continue reading)

R. David Murray | 18 Sep 16:26 2014

[issue22436] logging geteffectivelevel does not document its return value


New submission from R. David Murray:

https://docs.python.org/3/library/logging.html#logging.Logger.getEffectiveLevel

This says the logging level is returned, but it doesn't mention that what is returned is an integer, nor does
it link to whatever method is needed to convert the integer return value into the symbolic name that the
user has been using elsewhere in interacting with logging.  Indeed, the section that shows the mapping
between names and numbers implies that the user of the library never needs to worry about the numbers
unless they are creating a new level, but if they want to use getEffectiveLevel, this is not true.

----------
assignee: docs <at> python
components: Documentation
messages: 227047
nosy: docs <at> python, r.david.murray, vinay.sajip
priority: normal
severity: normal
status: open
title: logging geteffectivelevel does not document its return value
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue22436>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org
(Continue reading)

Serhiy Storchaka | 18 Sep 12:54 2014

[issue1519638] Unmatched Group issue - workaround


Serhiy Storchaka added the comment:

Here is a patch which make unmatched groups to be replaced by empty string. These changes looks rather as new
feature than bug fix and therefore can be applied only to 3.5.

----------
components: +Library (Lib)
keywords: +patch
nosy: +serhiy.storchaka
stage:  -> patch review
type:  -> enhancement
versions: +Python 3.5 -Python 2.6, Python 2.7
Added file: http://bugs.python.org/file36650/re_sub_unmatched_group.patch

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue1519638>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Martin Panter | 18 Sep 02:25 2014

[issue22435] socketserver.TCPSocket leaks socket to garbage collector if server_bind() fails


New submission from Martin Panter:

Bind method may easily fail on Unix if there is no permission to bind to a privileged port:

>>> try: TCPServer(("", 80), ...)
... except Exception as err: err
... 
PermissionError(13, 'Permission denied')
>>> gc.collect()
__main__:1: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_INET,
type=SocketType.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 0)>
0

This problem is inherited by HTTPServer and WSGIServer. My current workaround includes this code in a
BaseServer fixup mixin, invoking server_close() if __init__() fails:

class Server(BaseServer, Context):
    def __init__(self, ...):
        try:
            super().__init__((host, port), RequestHandlerClass)
        except:  # Workaround for socketserver.TCPServer leaking socket
            self.close()
            raise

    def close(self):
        return self.server_close()

----------
components: Library (Lib)
(Continue reading)

Serhiy Storchaka | 17 Sep 18:09 2014

[issue22434] Use named constants internally in the re module


New submission from Serhiy Storchaka:

Regular expression parser parses a pattern to a tree, marking nodes by string identifiers. Regular
expression compiler converts this three into plain list of integers. Node's identifiers are
transformed to sequential integers. Resulting list is not human readable. Proposed patch converts
string constants in the sre_constants module to named integer constants. These constants doesn't need
converting to integers, because they are already integers, and when printed they looks human-friendly.
Now intermediate result of regular expression compiler looks much more readable.

Example.

>>> import re, sre_compile, sre_parse
>>> sre_compile._code(sre_parse.parse('[a-z_][a-z_0-9]+', re.I), re.I)

Before patch:

[17, 4, 0, 2, 2147483647, 16, 7, 27, 97, 122, 19, 95, 0, 29, 16, 1, 2147483647, 16, 11, 10, 0, 67043328,
2147483648, 134217726, 0, 0, 0, 0, 0, 1, 1]

After patch:

[INFO, 4, 0, 2, MAXREPEAT, IN_IGNORE, 7, RANGE, 97, 122, LITERAL, 95, FAILURE, REPEAT_ONE, 16, 1,
MAXREPEAT, IN_IGNORE, 11, CHARSET, 0, 67043328, 2147483648, 134217726, 0, 0, 0, 0, FAILURE, SUCCESS, SUCCESS]

This patch also affects debugging output when regular expression is compiled with re.DEBUG (identifiers
are uppercased and MAXREPEAT is displayed instead of 2147483647 in repeat statements).

Besides debugging output these changes are invisible for ordinal user. They are needed only for
developing and debugging the re module itself. The patch doesn't affect performance and almost not
(Continue reading)


Gmane