agrim khanna | 29 Jul 22:44 2014
Picon

Contribute to Python.org

Respected Sir/Madam,

I have installed the setup on my machine and have compiled and run it as well. I was unable to figure out how to make a patch and how to find a suitable bug for me to fix. I request you to guide me in the same.

Yours Sincerely,
Agrim Khanna
IIIT-Allahabad, India
<div><div dir="ltr">
<div>Respected Sir/Madam,<br><br>
</div>I have installed the setup on my 
machine and have compiled and run it as well. I was unable to figure out
 how to make a patch and how to find a suitable bug for me to fix. I 
request you to guide me in the same.<br><br><div>Yours Sincerely,<br>
</div>
<div>Agrim Khanna<br>
</div>IIIT-Allahabad, India</div></div>
agrim khanna | 29 Jul 17:11 2014
Picon

Contribute to Python.org

Respected Sir,

I am Agrim Khanna, undergraduate student in IIIT Allahabad, India. I wanted to contribute to python.org but didnt know how to start. I have elementary knowledge of python language.

Could you please help me on the same.

Yours Sincerely,
Agrim Khanna
IIIT-Allahabad
<div><div dir="ltr">
<div>
<div>Respected Sir,<br>
</div>
<div><br></div>I am Agrim Khanna, undergraduate student in IIIT Allahabad, India. I wanted to contribute to <a href="http://python.org">python.org</a> but didnt know how to start. I have elementary knowledge of python language.<br><br>
</div>
<div>Could you please help me on the same.<br><br>
</div>
<div>Yours Sincerely,<br>
</div>
<div>Agrim Khanna<br>
</div>
<div>IIIT-Allahabad<br>
</div>
</div></div>
Python tracker | 25 Jul 18:07 2014

Summary of Python tracker Issues


ACTIVITY SUMMARY (2014-07-18 - 2014-07-25)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open    4591 ( +2)
  closed 29248 (+60)
  total  33839 (+62)

Open issues with patches: 2160 

Issues opened (42)
==================

#19884: Importing readline produces erroneous output
http://bugs.python.org/issue19884  reopened by haypo

#22010: Idle: better management of Shell window output
http://bugs.python.org/issue22010  opened by terry.reedy

#22011: test_os extended attribute setxattr tests can fail with ENOSPC
http://bugs.python.org/issue22011  opened by Hibou57

#22012: struct.unpack('?', '\x02') returns (False,) on Mac OSX
http://bugs.python.org/issue22012  opened by wayedt

#22013: Add at least minimal support for thread groups
http://bugs.python.org/issue22013  opened by rhettinger

#22014: Add summary table for OS exception <-> errno mapping
http://bugs.python.org/issue22014  opened by ncoghlan

#22016: Add a new 'surrogatereplace' output only error handler
http://bugs.python.org/issue22016  opened by ncoghlan

#22018: Add a new signal.set_wakeup_socket() function
http://bugs.python.org/issue22018  opened by haypo

#22021: shutil.make_archive()  root_dir do not work
http://bugs.python.org/issue22021  opened by DemoHT

#22023: PyUnicode_FromFormat is broken on python 2
http://bugs.python.org/issue22023  opened by alex

#22024: Add to shutil the ability to wait until files are definitely d
http://bugs.python.org/issue22024  opened by zach.ware

#22025: webbrowser.get(command_line) does not support Windows-style pa
http://bugs.python.org/issue22025  opened by dan.oreilly

#22027: RFC 6531 (SMTPUTF8) support in smtplib
http://bugs.python.org/issue22027  opened by zvyn

#22028: Python 3.4.1 Installer ended prematurely (Windows msi)
http://bugs.python.org/issue22028  opened by DieInSente

#22029: argparse - CSS white-space: like control for individual text b
http://bugs.python.org/issue22029  opened by paul.j3

#22033: Subclass friendly reprs
http://bugs.python.org/issue22033  opened by serhiy.storchaka

#22034: posixpath.join() and bytearray
http://bugs.python.org/issue22034  opened by serhiy.storchaka

#22035: Fatal error in dbm.gdbm
http://bugs.python.org/issue22035  opened by serhiy.storchaka

#22038: Implement atomic operations on non-x86 platforms
http://bugs.python.org/issue22038  opened by Vitor.de.Lima

#22039: PyObject_SetAttr doesn't mention value = NULL
http://bugs.python.org/issue22039  opened by pitrou

#22041: http POST request with python 3.3 through web proxy
http://bugs.python.org/issue22041  opened by AlexMJ

#22042: signal.set_wakeup_fd(fd): set the fd to non-blocking mode
http://bugs.python.org/issue22042  opened by haypo

#22043: Use a monotonic clock to compute timeouts
http://bugs.python.org/issue22043  opened by haypo

#22044: Premature Py_DECREF while generating a TypeError in call_tzinf
http://bugs.python.org/issue22044  opened by Knio

#22045: Python make issue
http://bugs.python.org/issue22045  opened by skerr

#22046: ZipFile.read() should mention that it might throw NotImplement
http://bugs.python.org/issue22046  opened by detly

#22047: argparse improperly prints mutually exclusive options when the
http://bugs.python.org/issue22047  opened by Sam.Kerr

#22049: argparse: type=<callable> doesn't honor nargs > 1
http://bugs.python.org/issue22049  opened by Chris.Bruner

#22051: Turtledemo: stop reloading demos
http://bugs.python.org/issue22051  opened by terry.reedy

#22052: Comparison operators called in reverse order for subclasses wi
http://bugs.python.org/issue22052  opened by mark.dickinson

#22054: Add os.get_blocking() and os.set_blocking() functions
http://bugs.python.org/issue22054  opened by haypo

#22057: The doc say all globals are copied on eval(), but only __built
http://bugs.python.org/issue22057  opened by amishne

#22058: datetime.datetime() should accept a datetime.date as init para
http://bugs.python.org/issue22058  opened by facundobatista

#22059: incorrect type conversion from str to bytes in asynchat module
http://bugs.python.org/issue22059  opened by hoxily

#22060: Clean up ctypes.test, use unittest test discovery
http://bugs.python.org/issue22060  opened by zach.ware

#22062: Fix pathlib.Path.(r)glob doc glitches.
http://bugs.python.org/issue22062  opened by terry.reedy

#22063: asyncio: sock_xxx() methods of event loops should make the soc
http://bugs.python.org/issue22063  opened by haypo

#22064: Misleading message from 2to3 when skipping optional fixers
http://bugs.python.org/issue22064  opened by ncoghlan

#22065: Update turtledemo menu creation
http://bugs.python.org/issue22065  opened by terry.reedy

#22066: subprocess.communicate() does not receive full output from the
http://bugs.python.org/issue22066  opened by juj

#22067: time_test fails after strptime()
http://bugs.python.org/issue22067  opened by serhiy.storchaka

#22068: test_gc fails after test_idle
http://bugs.python.org/issue22068  opened by serhiy.storchaka

Most recent 15 issues with no replies (15)
==========================================

#22067: time_test fails after strptime()
http://bugs.python.org/issue22067

#22066: subprocess.communicate() does not receive full output from the
http://bugs.python.org/issue22066

#22064: Misleading message from 2to3 when skipping optional fixers
http://bugs.python.org/issue22064

#22060: Clean up ctypes.test, use unittest test discovery
http://bugs.python.org/issue22060

#22057: The doc say all globals are copied on eval(), but only __built
http://bugs.python.org/issue22057

#22051: Turtledemo: stop reloading demos
http://bugs.python.org/issue22051

#22046: ZipFile.read() should mention that it might throw NotImplement
http://bugs.python.org/issue22046

#22045: Python make issue
http://bugs.python.org/issue22045

#22039: PyObject_SetAttr doesn't mention value = NULL
http://bugs.python.org/issue22039

#22035: Fatal error in dbm.gdbm
http://bugs.python.org/issue22035

#22034: posixpath.join() and bytearray
http://bugs.python.org/issue22034

#22033: Subclass friendly reprs
http://bugs.python.org/issue22033

#22027: RFC 6531 (SMTPUTF8) support in smtplib
http://bugs.python.org/issue22027

#22024: Add to shutil the ability to wait until files are definitely d
http://bugs.python.org/issue22024

#22016: Add a new 'surrogatereplace' output only error handler
http://bugs.python.org/issue22016

Most recent 15 issues waiting for review (15)
=============================================

#22068: test_gc fails after test_idle
http://bugs.python.org/issue22068

#22065: Update turtledemo menu creation
http://bugs.python.org/issue22065

#22060: Clean up ctypes.test, use unittest test discovery
http://bugs.python.org/issue22060

#22054: Add os.get_blocking() and os.set_blocking() functions
http://bugs.python.org/issue22054

#22051: Turtledemo: stop reloading demos
http://bugs.python.org/issue22051

#22044: Premature Py_DECREF while generating a TypeError in call_tzinf
http://bugs.python.org/issue22044

#22043: Use a monotonic clock to compute timeouts
http://bugs.python.org/issue22043

#22042: signal.set_wakeup_fd(fd): set the fd to non-blocking mode
http://bugs.python.org/issue22042

#22041: http POST request with python 3.3 through web proxy
http://bugs.python.org/issue22041

#22038: Implement atomic operations on non-x86 platforms
http://bugs.python.org/issue22038

#22035: Fatal error in dbm.gdbm
http://bugs.python.org/issue22035

#22034: posixpath.join() and bytearray
http://bugs.python.org/issue22034

#22033: Subclass friendly reprs
http://bugs.python.org/issue22033

#22029: argparse - CSS white-space: like control for individual text b
http://bugs.python.org/issue22029

#22027: RFC 6531 (SMTPUTF8) support in smtplib
http://bugs.python.org/issue22027

Top 10 most discussed issues (10)
=================================

#22018: Add a new signal.set_wakeup_socket() function
http://bugs.python.org/issue22018  35 msgs

#22003: BytesIO copy-on-write
http://bugs.python.org/issue22003  18 msgs

#21933: Allow the user to change font sizes with the text pane of turt
http://bugs.python.org/issue21933  16 msgs

#22012: struct.unpack('?', '\x02') returns (False,) on Mac OSX
http://bugs.python.org/issue22012  10 msgs

#1602: windows console doesn't print or input Unicode
http://bugs.python.org/issue1602   9 msgs

#22041: http POST request with python 3.3 through web proxy
http://bugs.python.org/issue22041   8 msgs

#22058: datetime.datetime() should accept a datetime.date as init para
http://bugs.python.org/issue22058   8 msgs

#18643: add a fallback socketpair() implementation in test.support
http://bugs.python.org/issue18643   7 msgs

#19884: Importing readline produces erroneous output
http://bugs.python.org/issue19884   7 msgs

#22013: Add at least minimal support for thread groups
http://bugs.python.org/issue22013   7 msgs

Issues closed (60)
==================

#1049450: Solaris: EINTR exception in select/socket calls in telnetlib
http://bugs.python.org/issue1049450  closed by haypo

#4350: Remove dead code from Tkinter.py
http://bugs.python.org/issue4350  closed by serhiy.storchaka

#5718: Problem compiling ffi part of build on AIX 5.3.
http://bugs.python.org/issue5718  closed by skrah

#6167: Tkinter.Scrollbar: the activate method needs to return a value
http://bugs.python.org/issue6167  closed by serhiy.storchaka

#11266: asyncore does not handle EINTR in recv, send, connect, accept,
http://bugs.python.org/issue11266  closed by haypo

#11945: Adopt and document consistent semantics for handling NaN value
http://bugs.python.org/issue11945  closed by rhettinger

#12184: socketserver.ForkingMixin collect_children routine needs to co
http://bugs.python.org/issue12184  closed by neologix

#12801: C realpath not used by os.path.realpath
http://bugs.python.org/issue12801  closed by haypo

#15275: isinstance is called a more times that needed in ntpath
http://bugs.python.org/issue15275  closed by serhiy.storchaka

#15759: "make suspicious" doesn't display instructions in case of fail
http://bugs.python.org/issue15759  closed by serhiy.storchaka

#15982: asyncore.dispatcher does not handle windows socket error code 
http://bugs.python.org/issue15982  closed by haypo

#16133: asyncore.dispatcher.recv doesn't handle EAGAIN / EWOULDBLOCK
http://bugs.python.org/issue16133  closed by haypo

#16494: Add a method on importlib.SourceLoader for creating bytecode f
http://bugs.python.org/issue16494  closed by brett.cannon

#16547: IDLE raises an exception in tkinter after fresh file's text ha
http://bugs.python.org/issue16547  closed by serhiy.storchaka

#17210: documentation of PyUnicode_Format() states wrong argument type
http://bugs.python.org/issue17210  closed by python-dev

#17391: _cursesmodule Fails to Build on GCC 2.95 (static)
http://bugs.python.org/issue17391  closed by neologix

#17709: http://docs.python.org/2.7/objects.inv doesn't support :func:`
http://bugs.python.org/issue17709  closed by asvetlov

#18093: Move main functions to a separate Programs directory
http://bugs.python.org/issue18093  closed by ncoghlan

#18132: buttons in turtledemo disappear on small screens
http://bugs.python.org/issue18132  closed by terry.reedy

#18168: plistlib output self-sorted dictionary
http://bugs.python.org/issue18168  closed by serhiy.storchaka

#18392: Doc: PyObject_Malloc() is not documented
http://bugs.python.org/issue18392  closed by zach.ware

#18436: Add mapping of symbol to function to operator module
http://bugs.python.org/issue18436  closed by zach.ware

#19629: support.rmtree fails on symlinks under Windows
http://bugs.python.org/issue19629  closed by berker.peksag

#21035: Python's HTTP server implementations hangs after 16.343 reques
http://bugs.python.org/issue21035  closed by neologix

#21500: Make use of the "load_tests" protocol in test_importlib packag
http://bugs.python.org/issue21500  closed by zach.ware

#21566: make use of the new default socket.listen() backlog argument
http://bugs.python.org/issue21566  closed by neologix

#21597: Allow turtledemo code pane to get wider.
http://bugs.python.org/issue21597  closed by terry.reedy

#21645: asyncio: Race condition in signal handling on FreeBSD
http://bugs.python.org/issue21645  closed by haypo

#21665: 2.7.7 ttk widgets not themed
http://bugs.python.org/issue21665  closed by python-dev

#21772: platform.uname() not EINTR safe
http://bugs.python.org/issue21772  closed by neologix

#21813: Enhance doc of os.stat_result
http://bugs.python.org/issue21813  closed by haypo

#21868: Tbuffer in turtle allows negative size
http://bugs.python.org/issue21868  closed by rhettinger

#21882: turtledemo modules imported by test___all__ cause side effects
http://bugs.python.org/issue21882  closed by terry.reedy

#21888: plistlib.FMT_BINARY behavior doesn't send required dict parame
http://bugs.python.org/issue21888  closed by serhiy.storchaka

#21901: test_selectors.PollSelectorTestCase.test_above_fd_setsize repo
http://bugs.python.org/issue21901  closed by neologix

#21947: `Dis` module doesn't know how to disassemble generators
http://bugs.python.org/issue21947  closed by ncoghlan

#21976: Fix test_ssl.py to handle LibreSSL versioning appropriately
http://bugs.python.org/issue21976  closed by pitrou

#21989: Missing (optional) argument `start` and `end` in documentation
http://bugs.python.org/issue21989  closed by r.david.murray

#22002: Make full use of test discovery in test subpackages
http://bugs.python.org/issue22002  closed by python-dev

#22006: thread module documentation erroneously(?) states not all buil
http://bugs.python.org/issue22006  closed by mark.dickinson

#22007: sys.stdout.write on Python 2.7 is not EINTR safe
http://bugs.python.org/issue22007  closed by neologix

#22008: Symtable's syntax warning should contain the word "because"
http://bugs.python.org/issue22008  closed by python-dev

#22009: pdb.set_trace() crashes with UnicodeDecodeError when binary da
http://bugs.python.org/issue22009  closed by ned.deily

#22015: C signal handler doesn't save/restore errno
http://bugs.python.org/issue22015  closed by haypo

#22017: Bad reference counting in the _warnings module
http://bugs.python.org/issue22017  closed by python-dev

#22019: ntpath.join() error with Chinese character Path
http://bugs.python.org/issue22019  closed by ezio.melotti

#22020: tutorial 9.10. Generators statement error
http://bugs.python.org/issue22020  closed by ezio.melotti

#22022: test_pathlib: shutil.rmtree() sporadic failures on Windows
http://bugs.python.org/issue22022  closed by zach.ware

#22026: 2.7.8 ttk Button text display problem
http://bugs.python.org/issue22026  closed by zach.ware

#22030: Use calloc in set resizing
http://bugs.python.org/issue22030  closed by rhettinger

#22031: Hexadecimal id in reprs
http://bugs.python.org/issue22031  closed by serhiy.storchaka

#22032: Use __qualname__ together with __module__
http://bugs.python.org/issue22032  closed by serhiy.storchaka

#22036: Obsolete reference to stringobject in comment
http://bugs.python.org/issue22036  closed by python-dev

#22037: Poor grammar in asyncio TCP echo client example
http://bugs.python.org/issue22037  closed by asvetlov

#22040: Add a "force" parameter to shutil.rmtree
http://bugs.python.org/issue22040  closed by r.david.murray

#22048: Add weighted random choice to random package
http://bugs.python.org/issue22048  closed by mark.dickinson

#22050: argparse: read nargs > 1 options from file doesn't work
http://bugs.python.org/issue22050  closed by r.david.murray

#22053: turtledemo: clean up start and stop, fix warning
http://bugs.python.org/issue22053  closed by terry.reedy

#22055: Incomplete sentence in asyncio BaseEventLoop doc
http://bugs.python.org/issue22055  closed by asvetlov

#22061: Restore deleted tkinter functions with deprecaton dummies.
http://bugs.python.org/issue22061  closed by serhiy.storchaka
Phil Thompson | 24 Jul 18:55 2014

Does Zip Importer have to be Special?

I have an importer for use in applications that embed an interpreter 
that does a similar job to the Zip importer (except that the storage is 
a C data structure rather than a .zip file). Just like the Zip importer 
I need to import my importer and add it to sys.path_hooks. However the 
earliest opportunity I have to do this is after the Py_Initialize() call 
returns - but this is too late because some parts of the standard 
library have already needed to be imported.

My current workaround is to include a modified version of _bootstrap.py 
as a frozen module that has the necessary steps added to the end of its 
_install() function.

The Zip importer doesn't have this problem because it gets special 
treatment - the call to its equivalent code is hard-coded and happens 
exactly when needed.

What would help is a table of functions that were called where 
_PyImportZip_Init() is currently called. By default the only entry in 
the table would be _PyImportZip_Init. There would be a way of modifying 
the table, either like how PyImport_FrozenModules is handled or how 
Inittab is handled.

...or if there is a better solution that I have missed that doesn't 
require a modified _bootstrap.py.

Thanks,
Phil
Alex Gaynor | 22 Jul 23:03 2014
Picon

[PEP466] SSLSockets, and sockets, _socketobjects oh my!

Hi all,

I've been happily working on the SSL module backports for Python2 (pursuant to
PEP466), and I've hit something of a snag:

In python3, the SSLSocket keeps a weak reference to the underlying socket,
rather than a strong reference, as Python2 uses.

Unfortunately, due to the way sockets work in Python2, this doesn't work:

On Python2, _socketobject composes around _real_socket from the _socket module,
whereas on Python3, it subclasses _socket.socket. Since you now have a Python-
level class, you can weak reference it.

The question is:

a) Should we backport weak referencing _socket.sockets (changing the structure
   of the module seems overly invasive, albeit completely backwards
   compatible)?
b) Does anyone know why weak references are used in the first place? The commit
   message just alludes to fixing a leak with no reference to an issue.

Anyone who's interested in the state of the branch can see it at:
github.com/alex/cpython on the backport-ssl branch. Note that many many tests
are still failing, and you'll need to apply the patch from
http://bugs.python.org/issue22023 to get it to work.

Thanks,
Alex

PS: Any help in getting http://bugs.python.org/issue22023 landed which be very
much appreciated.

Victor Stinner | 22 Jul 00:26 2014
Picon

PEP 471 "scandir" accepted

Hi,

I asked privately Guido van Rossum if I can be the BDFL-delegate for
the PEP 471 and he agreed. I accept the latest version of the PEP:

    http://legacy.python.org/dev/peps/pep-0471/

I consider that the PEP 471 "scandir" was discussed enough to collect
all possible options (variations of the API) and that main flaws have
been detected. Ben Hoyt modified his PEP to list all these options,
and for each option gives advantages and drawbacks. Great job Ben :-)
Thanks all developers who contributed to the threads on the python-dev
mailing list!

The new version of the PEP has an optional "follow_symlinks" parameter
which is True by default. IMO this API fits better the common case,
list the content of a single directory, and it's now simple to not
follow symlinks to implement a recursive function like os.walk().

The PEP also explicitly mentions that os.walk() will be modified to
benefit of the new os.scandir() function.

I'm happy because the final API is very close to os.path functions and
pathlib.Path methods. Python stays consistent, which is a great power
of this language!

The PEP is accepted. It's time to review the implementation ;-) The
current code can be found at:

   https://github.com/benhoyt/scandir

(I don't think that Ben already updated his implementation for the
latest version of the PEP.)

Victor
anatoly techtonik | 20 Jul 16:34 2014
Picon

subprocess research - max limit for piped output

I am trying to figure out what is maximum size
for piped input in subprocess.check_output()

I've got limitation of about 500Mb after which
Python exits with MemoryError without any
additional details.

I have only 2.76Gb memory used out of 8Gb,
so what limit do I hit?

1. subprocess output read buffer
2. Python limit on size of variable
3. some OS limit on output pipes

Testcase attached.

C:\discovery\interface\subprocess>py dead.py
Testing size: 520Mb
..truncating to 545259520
..
Traceback (most recent call last):
  File "dead.py", line 66, in <module>
    backticks(r'type largefile')
  File "dead.py", line 36, in backticks
    output = subprocess.check_output(command, shell=True)
  File "C:\Python27\lib\subprocess.py", line 567, in check_output
    output, unused_err = process.communicate()
  File "C:\Python27\lib\subprocess.py", line 791, in communicate
    stdout = _eintr_retry_call(self.stdout.read)
  File "C:\Python27\lib\subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
MemoryError
The process tried to write to a nonexistent pipe.

-- 
anatoly t.
import subprocess

# --- replacing shell backticks ---
# https://docs.python.org/2/library/subprocess.html#replacing-bin-sh-shell-backquote
#   output=`mycmd myarg`
#   output = check_output(["mycmd", "myarg"])
# not true, because mycmd is not passed to shell
try:
    pass #output = subprocess.check_output(["mycmd", "myarg"], shell=True)
except OSError as ex:
    # command not found.
    # it is impossible to catch output here, but shell outputs
    # message to stderr, which backticks doesn't catch either
    output = ''
except subprocess.CalledProcessError as ex:
    output = ex.output
# ^ information about error condition is lost
# ^ output in case of OSError is lost

# ux notes:
# - `mycmd myarg` > ["mycmd", "myarg"]
# - `` is invisible
#   subprocess.check_output is hardly rememberable
# - exception checking is excessive and not needed
#   (common pattern is to check return code)

def backticks(command):
   '''
   - no return code
   - no stderr capture
   '''
   try:
       # this doesn't escape shell patterns, such as:
       # ^ (windows cmd.exe shell)
       output = subprocess.check_output(command, shell=True)
   except OSError as ex:
       # command not found.
       # it is impossible to catch output here, but shell outputs
       # message to stderr, which backticks doesn't catch either
       output = ''
   except subprocess.CalledProcessError as ex:
       output = ex.output
   return output

import os
for size in range(520, 600, 2):
    print("Testing size: %sMb" % size)
    #cursize = os.path.getsize("largefile")
    with open("largefile", "ab") as data:
        data.seek(0, 2)
        cursize = data.tell()
        #print(cursize)
        limit = size*1024**2
        if cursize > limit:
            print('..truncating to %s' % limit)
            data.truncate(limit)
        else:
            print('..extending to %s' % limit)
            while cursize < limit:
                toadd = min(100, limit-cursize)
                data.write('1'*99+'\n')
                cursize += 100
    print("..")
    backticks(r'type largefile')

import subprocess

# --- replacing shell backticks ---
# https://docs.python.org/2/library/subprocess.html#replacing-bin-sh-shell-backquote
#   output=`mycmd myarg`
#   output = check_output(["mycmd", "myarg"])
# not true, because mycmd is not passed to shell
try:
    pass #output = subprocess.check_output(["mycmd", "myarg"], shell=True)
except OSError as ex:
    # command not found.
    # it is impossible to catch output here, but shell outputs
    # message to stderr, which backticks doesn't catch either
    output = ''
except subprocess.CalledProcessError as ex:
    output = ex.output
# ^ information about error condition is lost
# ^ output in case of OSError is lost

# ux notes:
# - `mycmd myarg` > ["mycmd", "myarg"]
# - `` is invisible
#   subprocess.check_output is hardly rememberable
# - exception checking is excessive and not needed
#   (common pattern is to check return code)

def backticks(command):
   '''
   - no return code
   - no stderr capture
   '''
   try:
       # this doesn't escape shell patterns, such as:
       # ^ (windows cmd.exe shell)
       output = subprocess.check_output(command, shell=True)
   except OSError as ex:
       # command not found.
       # it is impossible to catch output here, but shell outputs
       # message to stderr, which backticks doesn't catch either
       output = ''
   except subprocess.CalledProcessError as ex:
       output = ex.output
   return output

import os
for size in range(520, 600, 2):
    print("Testing size: %sMb" % size)
    #cursize = os.path.getsize("largefile")
    with open("largefile", "ab") as data:
        data.seek(0, 2)
        cursize = data.tell()
        #print(cursize)
        limit = size*1024**2
        if cursize > limit:
            print('..truncating to %s' % limit)
            data.truncate(limit)
        else:
            print('..extending to %s' % limit)
            while cursize < limit:
                toadd = min(100, limit-cursize)
                data.write('1'*99+'\n')
                cursize += 100
    print("..")
    backticks(r'type largefile')

Python tracker | 18 Jul 18:07 2014

Summary of Python tracker Issues


ACTIVITY SUMMARY (2014-07-11 - 2014-07-18)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open    4589 ( +1)
  closed 29188 (+47)
  total  33777 (+48)

Open issues with patches: 2154 

Issues opened (36)
==================

#21044: tarfile does not handle file .name being an int
http://bugs.python.org/issue21044  reopened by zach.ware

#21946: 'python -u' yields trailing carriage return '\r'  (Python2 for
http://bugs.python.org/issue21946  reopened by haypo

#21950: import sqlite3 not running after configure --prefix=/alt/path;
http://bugs.python.org/issue21950  reopened by r.david.murray

#21958: Allow python 2.7 to compile with Visual Studio 2013
http://bugs.python.org/issue21958  opened by Zachary.Turner

#21960: Better path handling in Idle find in files
http://bugs.python.org/issue21960  opened by terry.reedy

#21961: Add What's New for Idle.
http://bugs.python.org/issue21961  opened by terry.reedy

#21962: No timeout for asyncio.Event.wait() or asyncio.Condition.wait(
http://bugs.python.org/issue21962  opened by ajaborsk

#21963: 2.7.8 backport of Issue1856 (avoid daemon thread problems at s
http://bugs.python.org/issue21963  opened by ned.deily

#21964: inconsistency in list-generator comprehension with yield(-from
http://bugs.python.org/issue21964  opened by hakril

#21965: Add support for Memory BIO to _ssl
http://bugs.python.org/issue21965  opened by geertj

#21967: Interpreter crash upon accessing frame.f_restricted of a frame
http://bugs.python.org/issue21967  opened by anselm.kruis

#21969: WindowsPath constructor does not check for invalid characters
http://bugs.python.org/issue21969  opened by Antony.Lee

#21970: Broken code for handling file://host in urllib.request.FileHan
http://bugs.python.org/issue21970  opened by vadmium

#21971: Index and update turtledemo doc.
http://bugs.python.org/issue21971  opened by terry.reedy

#21972: Bugs in the lexer and parser documentation
http://bugs.python.org/issue21972  opened by François-René.Rideau

#21973: Idle should not quit on corrupted user config files
http://bugs.python.org/issue21973  opened by Tomk

#21975: Using pickled/unpickled sqlite3.Row results in segfault rather
http://bugs.python.org/issue21975  opened by Elizacat

#21976: Fix test_ssl.py to handle LibreSSL versioning appropriately
http://bugs.python.org/issue21976  opened by worr

#21980: Implement `logging.LogRecord.__repr__`
http://bugs.python.org/issue21980  opened by cool-RR

#21983: segfault in ctypes.cast
http://bugs.python.org/issue21983  opened by Anthony.LaTorre

#21986: Pickleability of code objects is inconsistent
http://bugs.python.org/issue21986  opened by ppperry

#21987: TarFile.getmember on directory requires trailing slash iff ove
http://bugs.python.org/issue21987  opened by moloney

#21989: Missing (optional) argument `start` and `end` in documentation
http://bugs.python.org/issue21989  opened by SylvainDe

#21990: saxutils defines an inner class where a normal one would do
http://bugs.python.org/issue21990  opened by alex

#21991: The new email API should use MappingProxyType instead of retur
http://bugs.python.org/issue21991  opened by r.david.murray

#21992: New AST node Else() should be introduced
http://bugs.python.org/issue21992  opened by Igor.Bronshteyn

#21995: Idle: pseudofiles have no buffer attribute.
http://bugs.python.org/issue21995  opened by terry.reedy

#21996: gettarinfo method does not handle files without text string na
http://bugs.python.org/issue21996  opened by vadmium

#21997: Pdb.set_trace debugging does not end correctly in IDLE
http://bugs.python.org/issue21997  opened by ppperry

#21998: asyncio: a new self-pipe should be created in the child proces
http://bugs.python.org/issue21998  opened by haypo

#21999: shlex: bug in posix more handling of empty strings
http://bugs.python.org/issue21999  opened by isoschiz

#22000: cross type comparisons clarification
http://bugs.python.org/issue22000  opened by Jim.Jewett

#22001: containers "same" does not always mean "__eq__".
http://bugs.python.org/issue22001  opened by Jim.Jewett

#22002: Make full use of test discovery in test subpackages
http://bugs.python.org/issue22002  opened by zach.ware

#22003: BytesIO copy-on-write
http://bugs.python.org/issue22003  opened by dw

#22005: datetime.__setstate__ fails decoding python2 pickle
http://bugs.python.org/issue22005  opened by eddygeek

Most recent 15 issues with no replies (15)
==========================================

#22005: datetime.__setstate__ fails decoding python2 pickle
http://bugs.python.org/issue22005

#22000: cross type comparisons clarification
http://bugs.python.org/issue22000

#21999: shlex: bug in posix more handling of empty strings
http://bugs.python.org/issue21999

#21998: asyncio: a new self-pipe should be created in the child proces
http://bugs.python.org/issue21998

#21997: Pdb.set_trace debugging does not end correctly in IDLE
http://bugs.python.org/issue21997

#21996: gettarinfo method does not handle files without text string na
http://bugs.python.org/issue21996

#21995: Idle: pseudofiles have no buffer attribute.
http://bugs.python.org/issue21995

#21992: New AST node Else() should be introduced
http://bugs.python.org/issue21992

#21991: The new email API should use MappingProxyType instead of retur
http://bugs.python.org/issue21991

#21990: saxutils defines an inner class where a normal one would do
http://bugs.python.org/issue21990

#21989: Missing (optional) argument `start` and `end` in documentation
http://bugs.python.org/issue21989

#21971: Index and update turtledemo doc.
http://bugs.python.org/issue21971

#21967: Interpreter crash upon accessing frame.f_restricted of a frame
http://bugs.python.org/issue21967

#21965: Add support for Memory BIO to _ssl
http://bugs.python.org/issue21965

#21960: Better path handling in Idle find in files
http://bugs.python.org/issue21960

Most recent 15 issues waiting for review (15)
=============================================

#22003: BytesIO copy-on-write
http://bugs.python.org/issue22003

#22002: Make full use of test discovery in test subpackages
http://bugs.python.org/issue22002

#21999: shlex: bug in posix more handling of empty strings
http://bugs.python.org/issue21999

#21990: saxutils defines an inner class where a normal one would do
http://bugs.python.org/issue21990

#21989: Missing (optional) argument `start` and `end` in documentation
http://bugs.python.org/issue21989

#21986: Pickleability of code objects is inconsistent
http://bugs.python.org/issue21986

#21976: Fix test_ssl.py to handle LibreSSL versioning appropriately
http://bugs.python.org/issue21976

#21975: Using pickled/unpickled sqlite3.Row results in segfault rather
http://bugs.python.org/issue21975

#21965: Add support for Memory BIO to _ssl
http://bugs.python.org/issue21965

#21958: Allow python 2.7 to compile with Visual Studio 2013
http://bugs.python.org/issue21958

#21955: ceval.c: implement fast path for integers with a single digit
http://bugs.python.org/issue21955

#21951: tcl test change crashes AIX
http://bugs.python.org/issue21951

#21947: `Dis` module doesn't know how to disassemble generators
http://bugs.python.org/issue21947

#21944: Allow copying of CodecInfo objects
http://bugs.python.org/issue21944

#21941: Clean up turtle TPen class
http://bugs.python.org/issue21941

Top 10 most discussed issues (10)
=================================

#21645: asyncio: Race condition in signal handling on FreeBSD
http://bugs.python.org/issue21645  16 msgs

#15443: datetime module has no support for nanoseconds
http://bugs.python.org/issue15443  14 msgs

#21815: imaplib truncates some untagged responses
http://bugs.python.org/issue21815  14 msgs

#21935: Implement AUTH command in smtpd.
http://bugs.python.org/issue21935  11 msgs

#21955: ceval.c: implement fast path for integers with a single digit
http://bugs.python.org/issue21955  10 msgs

#21975: Using pickled/unpickled sqlite3.Row results in segfault rather
http://bugs.python.org/issue21975   9 msgs

#21986: Pickleability of code objects is inconsistent
http://bugs.python.org/issue21986   9 msgs

#21927: BOM appears in stdin when using Powershell
http://bugs.python.org/issue21927   8 msgs

#1598: unexpected response in imaplib
http://bugs.python.org/issue1598   7 msgs

#18320: python installation is broken if prefix is overridden on an in
http://bugs.python.org/issue18320   7 msgs

Issues closed (43)
==================

#8849: python.exe problem with cvxopt
http://bugs.python.org/issue8849  closed by r.david.murray

#9390: Error in sys.excepthook on windows when redirecting output of 
http://bugs.python.org/issue9390  closed by zach.ware

#14714: PEP 414 tokenizing hook does not preserve tabs
http://bugs.python.org/issue14714  closed by aronacher

#15962: Windows STDIN/STDOUT Redirection is actually FIXED
http://bugs.python.org/issue15962  closed by terry.reedy

#16178: atexit._run_exitfuncs should be a public API
http://bugs.python.org/issue16178  closed by rhettinger

#16237: bdist_rpm SPEC files created with distutils may be distro spec
http://bugs.python.org/issue16237  closed by ncoghlan

#16382: Better warnings exception for bad category
http://bugs.python.org/issue16382  closed by berker.peksag

#16859: tarfile.TarInfo.fromtarfile does not check read() return value
http://bugs.python.org/issue16859  closed by lars.gustaebel

#16895: Batch file to mimic 'make' on Windows
http://bugs.python.org/issue16895  closed by zach.ware

#17308: Dialog.py crashes when putty Window resized
http://bugs.python.org/issue17308  closed by berker.peksag

#18144: FD leak in urllib2
http://bugs.python.org/issue18144  closed by serhiy.storchaka

#18974: Use argparse in the diff script
http://bugs.python.org/issue18974  closed by serhiy.storchaka

#19076: Pdb.do_break calls error with obsolete file kwarg
http://bugs.python.org/issue19076  closed by berker.peksag

#19355: Initial modernization of OpenWatcom support
http://bugs.python.org/issue19355  closed by Jeffrey.Armstrong

#20451: os.exec* mangles argv on windows (splits on spaces, etc)
http://bugs.python.org/issue20451  closed by rhettinger

#21059: idle_test.test_warning failure
http://bugs.python.org/issue21059  closed by zach.ware

#21163: asyncio doesn't warn if a task is destroyed during its executi
http://bugs.python.org/issue21163  closed by haypo

#21247: test_asyncio: test_subprocess_send_signal hangs on Fedora buil
http://bugs.python.org/issue21247  closed by haypo

#21323: CGI HTTP server not running scripts from subdirectories
http://bugs.python.org/issue21323  closed by ned.deily

#21599: Argument transport in attach and detach method in Server class
http://bugs.python.org/issue21599  closed by haypo

#21655: Write Unit Test for Vec2 and TNavigator class in the Turtle Mo
http://bugs.python.org/issue21655  closed by Lita.Cho

#21765: Idle: make 3.x HyperParser work with non-ascii identifiers.
http://bugs.python.org/issue21765  closed by terry.reedy

#21899: Futures are not marked as completed
http://bugs.python.org/issue21899  closed by Sebastian.Kreft.Deezer

#21906: Tools\Scripts\md5sum.py doesn't work in Python 3.x
http://bugs.python.org/issue21906  closed by berker.peksag

#21913: threading.Condition.wait() is not interruptible in Python 2.7
http://bugs.python.org/issue21913  closed by neologix

#21918: Convert test_tools to directory
http://bugs.python.org/issue21918  closed by zach.ware

#21953: pythonrun.c does not check std streams the same as fileio.c
http://bugs.python.org/issue21953  closed by steve.dower

#21957: ASCII Formfeed (FF) & ASCII Vertical Tab (VT) Have Hexadecimal
http://bugs.python.org/issue21957  closed by ned.deily

#21959: msi product code for 2.7.8150 not in Tools/msi/uuids.py
http://bugs.python.org/issue21959  closed by r.david.murray

#21966: InteractiveConsole does not support -q option
http://bugs.python.org/issue21966  closed by belopolsky

#21968: 'abort' object is not callable
http://bugs.python.org/issue21968  closed by Apple Grew

#21974: Typo in "Set" in PEP 289
http://bugs.python.org/issue21974  closed by rhettinger

#21977: In the re's token example OP and SKIP regexes can be improved
http://bugs.python.org/issue21977  closed by rhettinger

#21978: Support index access on OrderedDict views (e.g. o.keys()[7])
http://bugs.python.org/issue21978  closed by rhettinger

#21979: SyntaxError not raised on "0xaor 1"
http://bugs.python.org/issue21979  closed by mark.dickinson

#21981: Idle problem
http://bugs.python.org/issue21981  closed by eric.smith

#21982: Idle configDialog: fix regression and add minimal unittest
http://bugs.python.org/issue21982  closed by terry.reedy

#21984: list(itertools.repeat(1)) causes the system to hang
http://bugs.python.org/issue21984  closed by rhettinger

#21985: test_asyncio prints some junk
http://bugs.python.org/issue21985  closed by haypo

#21988: Decrease iterating overhead in timeit
http://bugs.python.org/issue21988  closed by gvanrossum

#21993: counterintuitive behavior of list.index with boolean values
http://bugs.python.org/issue21993  closed by ezio.melotti

#21994: Syntax error in the ssl module documentation
http://bugs.python.org/issue21994  closed by berker.peksag

#22004: io documentation refers to newline as newlines
http://bugs.python.org/issue22004  closed by python-dev

ACTIVITY SUMMARY (2014-07-11 - 2014-07-18)
Python tracker at http://bugs.python.org/

To view or respond to any of the issues listed below, click on the issue.
Do NOT respond to this message.

Issues counts and deltas:
  open    4589 ( +1)
  closed 29188 (+47)
  total  33777 (+48)

Open issues with patches: 2154 

Issues opened (36)
==================

#21044: tarfile does not handle file .name being an int
http://bugs.python.org/issue21044  reopened by zach.ware

#21946: 'python -u' yields trailing carriage return '\r'  (Python2 for
http://bugs.python.org/issue21946  reopened by haypo

#21950: import sqlite3 not running after configure --prefix=/alt/path;
http://bugs.python.org/issue21950  reopened by r.david.murray

#21958: Allow python 2.7 to compile with Visual Studio 2013
http://bugs.python.org/issue21958  opened by Zachary.Turner

#21960: Better path handling in Idle find in files
http://bugs.python.org/issue21960  opened by terry.reedy

#21961: Add What's New for Idle.
http://bugs.python.org/issue21961  opened by terry.reedy

#21962: No timeout for asyncio.Event.wait() or asyncio.Condition.wait(
http://bugs.python.org/issue21962  opened by ajaborsk

#21963: 2.7.8 backport of Issue1856 (avoid daemon thread problems at s
http://bugs.python.org/issue21963  opened by ned.deily

#21964: inconsistency in list-generator comprehension with yield(-from
http://bugs.python.org/issue21964  opened by hakril

#21965: Add support for Memory BIO to _ssl
http://bugs.python.org/issue21965  opened by geertj

#21967: Interpreter crash upon accessing frame.f_restricted of a frame
http://bugs.python.org/issue21967  opened by anselm.kruis

#21969: WindowsPath constructor does not check for invalid characters
http://bugs.python.org/issue21969  opened by Antony.Lee

#21970: Broken code for handling file://host in urllib.request.FileHan
http://bugs.python.org/issue21970  opened by vadmium

#21971: Index and update turtledemo doc.
http://bugs.python.org/issue21971  opened by terry.reedy

#21972: Bugs in the lexer and parser documentation
http://bugs.python.org/issue21972  opened by François-René.Rideau

#21973: Idle should not quit on corrupted user config files
http://bugs.python.org/issue21973  opened by Tomk

#21975: Using pickled/unpickled sqlite3.Row results in segfault rather
http://bugs.python.org/issue21975  opened by Elizacat

#21976: Fix test_ssl.py to handle LibreSSL versioning appropriately
http://bugs.python.org/issue21976  opened by worr

#21980: Implement `logging.LogRecord.__repr__`
http://bugs.python.org/issue21980  opened by cool-RR

#21983: segfault in ctypes.cast
http://bugs.python.org/issue21983  opened by Anthony.LaTorre

#21986: Pickleability of code objects is inconsistent
http://bugs.python.org/issue21986  opened by ppperry

#21987: TarFile.getmember on directory requires trailing slash iff ove
http://bugs.python.org/issue21987  opened by moloney

#21989: Missing (optional) argument `start` and `end` in documentation
http://bugs.python.org/issue21989  opened by SylvainDe

#21990: saxutils defines an inner class where a normal one would do
http://bugs.python.org/issue21990  opened by alex

#21991: The new email API should use MappingProxyType instead of retur
http://bugs.python.org/issue21991  opened by r.david.murray

#21992: New AST node Else() should be introduced
http://bugs.python.org/issue21992  opened by Igor.Bronshteyn

#21995: Idle: pseudofiles have no buffer attribute.
http://bugs.python.org/issue21995  opened by terry.reedy

#21996: gettarinfo method does not handle files without text string na
http://bugs.python.org/issue21996  opened by vadmium

#21997: Pdb.set_trace debugging does not end correctly in IDLE
http://bugs.python.org/issue21997  opened by ppperry

#21998: asyncio: a new self-pipe should be created in the child proces
http://bugs.python.org/issue21998  opened by haypo

#21999: shlex: bug in posix more handling of empty strings
http://bugs.python.org/issue21999  opened by isoschiz

#22000: cross type comparisons clarification
http://bugs.python.org/issue22000  opened by Jim.Jewett

#22001: containers "same" does not always mean "__eq__".
http://bugs.python.org/issue22001  opened by Jim.Jewett

#22002: Make full use of test discovery in test subpackages
http://bugs.python.org/issue22002  opened by zach.ware

#22003: BytesIO copy-on-write
http://bugs.python.org/issue22003  opened by dw

#22005: datetime.__setstate__ fails decoding python2 pickle
http://bugs.python.org/issue22005  opened by eddygeek

Most recent 15 issues with no replies (15)
==========================================

#22005: datetime.__setstate__ fails decoding python2 pickle
http://bugs.python.org/issue22005

#22000: cross type comparisons clarification
http://bugs.python.org/issue22000

#21999: shlex: bug in posix more handling of empty strings
http://bugs.python.org/issue21999

#21998: asyncio: a new self-pipe should be created in the child proces
http://bugs.python.org/issue21998

#21997: Pdb.set_trace debugging does not end correctly in IDLE
http://bugs.python.org/issue21997

#21996: gettarinfo method does not handle files without text string na
http://bugs.python.org/issue21996

#21995: Idle: pseudofiles have no buffer attribute.
http://bugs.python.org/issue21995

#21992: New AST node Else() should be introduced
http://bugs.python.org/issue21992

#21991: The new email API should use MappingProxyType instead of retur
http://bugs.python.org/issue21991

#21990: saxutils defines an inner class where a normal one would do
http://bugs.python.org/issue21990

#21989: Missing (optional) argument `start` and `end` in documentation
http://bugs.python.org/issue21989

#21971: Index and update turtledemo doc.
http://bugs.python.org/issue21971

#21967: Interpreter crash upon accessing frame.f_restricted of a frame
http://bugs.python.org/issue21967

#21965: Add support for Memory BIO to _ssl
http://bugs.python.org/issue21965

#21960: Better path handling in Idle find in files
http://bugs.python.org/issue21960

Most recent 15 issues waiting for review (15)
=============================================

#22003: BytesIO copy-on-write
http://bugs.python.org/issue22003

#22002: Make full use of test discovery in test subpackages
http://bugs.python.org/issue22002

#21999: shlex: bug in posix more handling of empty strings
http://bugs.python.org/issue21999

#21990: saxutils defines an inner class where a normal one would do
http://bugs.python.org/issue21990

#21989: Missing (optional) argument `start` and `end` in documentation
http://bugs.python.org/issue21989

#21986: Pickleability of code objects is inconsistent
http://bugs.python.org/issue21986

#21976: Fix test_ssl.py to handle LibreSSL versioning appropriately
http://bugs.python.org/issue21976

#21975: Using pickled/unpickled sqlite3.Row results in segfault rather
http://bugs.python.org/issue21975

#21965: Add support for Memory BIO to _ssl
http://bugs.python.org/issue21965

#21958: Allow python 2.7 to compile with Visual Studio 2013
http://bugs.python.org/issue21958

#21955: ceval.c: implement fast path for integers with a single digit
http://bugs.python.org/issue21955

#21951: tcl test change crashes AIX
http://bugs.python.org/issue21951

#21947: `Dis` module doesn't know how to disassemble generators
http://bugs.python.org/issue21947

#21944: Allow copying of CodecInfo objects
http://bugs.python.org/issue21944

#21941: Clean up turtle TPen class
http://bugs.python.org/issue21941

Top 10 most discussed issues (10)
=================================

#21645: asyncio: Race condition in signal handling on FreeBSD
http://bugs.python.org/issue21645  16 msgs

#15443: datetime module has no support for nanoseconds
http://bugs.python.org/issue15443  14 msgs

#21815: imaplib truncates some untagged responses
http://bugs.python.org/issue21815  14 msgs

#21935: Implement AUTH command in smtpd.
http://bugs.python.org/issue21935  11 msgs

#21955: ceval.c: implement fast path for integers with a single digit
http://bugs.python.org/issue21955  10 msgs

#21975: Using pickled/unpickled sqlite3.Row results in segfault rather
http://bugs.python.org/issue21975   9 msgs

#21986: Pickleability of code objects is inconsistent
http://bugs.python.org/issue21986   9 msgs

#21927: BOM appears in stdin when using Powershell
http://bugs.python.org/issue21927   8 msgs

#1598: unexpected response in imaplib
http://bugs.python.org/issue1598   7 msgs

#18320: python installation is broken if prefix is overridden on an in
http://bugs.python.org/issue18320   7 msgs

Issues closed (43)
==================

#8849: python.exe problem with cvxopt
http://bugs.python.org/issue8849  closed by r.david.murray

#9390: Error in sys.excepthook on windows when redirecting output of 
http://bugs.python.org/issue9390  closed by zach.ware

#14714: PEP 414 tokenizing hook does not preserve tabs
http://bugs.python.org/issue14714  closed by aronacher

#15962: Windows STDIN/STDOUT Redirection is actually FIXED
http://bugs.python.org/issue15962  closed by terry.reedy

#16178: atexit._run_exitfuncs should be a public API
http://bugs.python.org/issue16178  closed by rhettinger

#16237: bdist_rpm SPEC files created with distutils may be distro spec
http://bugs.python.org/issue16237  closed by ncoghlan

#16382: Better warnings exception for bad category
http://bugs.python.org/issue16382  closed by berker.peksag

#16859: tarfile.TarInfo.fromtarfile does not check read() return value
http://bugs.python.org/issue16859  closed by lars.gustaebel

#16895: Batch file to mimic 'make' on Windows
http://bugs.python.org/issue16895  closed by zach.ware

#17308: Dialog.py crashes when putty Window resized
http://bugs.python.org/issue17308  closed by berker.peksag

#18144: FD leak in urllib2
http://bugs.python.org/issue18144  closed by serhiy.storchaka

#18974: Use argparse in the diff script
http://bugs.python.org/issue18974  closed by serhiy.storchaka

#19076: Pdb.do_break calls error with obsolete file kwarg
http://bugs.python.org/issue19076  closed by berker.peksag

#19355: Initial modernization of OpenWatcom support
http://bugs.python.org/issue19355  closed by Jeffrey.Armstrong

#20451: os.exec* mangles argv on windows (splits on spaces, etc)
http://bugs.python.org/issue20451  closed by rhettinger

#21059: idle_test.test_warning failure
http://bugs.python.org/issue21059  closed by zach.ware

#21163: asyncio doesn't warn if a task is destroyed during its executi
http://bugs.python.org/issue21163  closed by haypo

#21247: test_asyncio: test_subprocess_send_signal hangs on Fedora buil
http://bugs.python.org/issue21247  closed by haypo

#21323: CGI HTTP server not running scripts from subdirectories
http://bugs.python.org/issue21323  closed by ned.deily

#21599: Argument transport in attach and detach method in Server class
http://bugs.python.org/issue21599  closed by haypo

#21655: Write Unit Test for Vec2 and TNavigator class in the Turtle Mo
http://bugs.python.org/issue21655  closed by Lita.Cho

#21765: Idle: make 3.x HyperParser work with non-ascii identifiers.
http://bugs.python.org/issue21765  closed by terry.reedy

#21899: Futures are not marked as completed
http://bugs.python.org/issue21899  closed by Sebastian.Kreft.Deezer

#21906: Tools\Scripts\md5sum.py doesn't work in Python 3.x
http://bugs.python.org/issue21906  closed by berker.peksag

#21913: threading.Condition.wait() is not interruptible in Python 2.7
http://bugs.python.org/issue21913  closed by neologix

#21918: Convert test_tools to directory
http://bugs.python.org/issue21918  closed by zach.ware

#21953: pythonrun.c does not check std streams the same as fileio.c
http://bugs.python.org/issue21953  closed by steve.dower

#21957: ASCII Formfeed (FF) & ASCII Vertical Tab (VT) Have Hexadecimal
http://bugs.python.org/issue21957  closed by ned.deily

#21959: msi product code for 2.7.8150 not in Tools/msi/uuids.py
http://bugs.python.org/issue21959  closed by r.david.murray

#21966: InteractiveConsole does not support -q option
http://bugs.python.org/issue21966  closed by belopolsky

#21968: 'abort' object is not callable
http://bugs.python.org/issue21968  closed by Apple Grew

#21974: Typo in "Set" in PEP 289
http://bugs.python.org/issue21974  closed by rhettinger

#21977: In the re's token example OP and SKIP regexes can be improved
http://bugs.python.org/issue21977  closed by rhettinger

#21978: Support index access on OrderedDict views (e.g. o.keys()[7])
http://bugs.python.org/issue21978  closed by rhettinger

#21979: SyntaxError not raised on "0xaor 1"
http://bugs.python.org/issue21979  closed by mark.dickinson

#21981: Idle problem
http://bugs.python.org/issue21981  closed by eric.smith

#21982: Idle configDialog: fix regression and add minimal unittest
http://bugs.python.org/issue21982  closed by terry.reedy

#21984: list(itertools.repeat(1)) causes the system to hang
http://bugs.python.org/issue21984  closed by rhettinger

#21985: test_asyncio prints some junk
http://bugs.python.org/issue21985  closed by haypo

#21988: Decrease iterating overhead in timeit
http://bugs.python.org/issue21988  closed by gvanrossum

#21993: counterintuitive behavior of list.index with boolean values
http://bugs.python.org/issue21993  closed by ezio.melotti

#21994: Syntax error in the ssl module documentation
http://bugs.python.org/issue21994  closed by berker.peksag

#22004: io documentation refers to newline as newlines
http://bugs.python.org/issue22004  closed by python-dev
Mikhail Korobov | 16 Jul 23:44 2014
Picon

cStringIO vs io.BytesIO

Hi,

cStringIO was removed from Python 3. It seems the suggested replacement is io.BytesIO. But there is a problem: cStringIO.StringIO(b'data') didn't copy the data while io.BytesIO(b'data') makes a copy (even if the data is not modified later).

This means io.BytesIO is not suited well to cases when you want to get a readonly file-like interface for existing byte strings. Isn't it one of the main io.BytesIO use cases? Wrapping bytes in cStringIO.StringIO used to be almost free, but this is not true for io.BytesIO.

So making code 3.x compatible by ditching cStringIO can cause a serious performance/memory  regressions. One can change the code to build the data using BytesIO (without creating bytes objects in the first place), but that is not always possible or convenient.

I believe this problem affects tornado (https://github.com/tornadoweb/tornado/issues/1110), Scrapy (this is how I became aware of this issue), NLTK (anecdotical evidence - I tried to port some hairy NLTK module to io.BytesIO, it became many times slower) and maybe pretty much every IO-related project ported to Python 3.x (django - check, werkzeug and frameworks based on it - check, requests - check - they all wrap user data to BytesIO, and this may cause slowdowns and up to 2x memory usage in Python 3.x).

Do you know if there a workaround? Maybe there is some stdlib part that I'm missing, or a module on PyPI? It is not that hard to write an own wrapper that won't do copies (or to port [c]StringIO to 3.x), but I wonder if there is an existing solution or plans to fix it in Python itself - this BytesIO use case looks quite important.
<div><div dir="ltr">
<div>
<div>Hi,<br><br>
</div>cStringIO was removed from Python 3. It seems the suggested replacement is io.BytesIO. But there is a problem: cStringIO.StringIO(b'data') didn't copy the data while io.BytesIO(b'data') makes a copy (even if the data is not modified later).<br><br>This means io.BytesIO is not suited well to cases when you want to get a readonly file-like interface for existing byte strings. Isn't it one of the main io.BytesIO use cases?  Wrapping bytes in cStringIO.StringIO used to be almost free, but this is not true for io.BytesIO. <br><br>So making code 3.x compatible by ditching cStringIO can cause a serious performance/memory&nbsp; regressions. One can change the code to build the data using BytesIO (without creating bytes objects in the first place), but that is not always possible or convenient.<br><br>I believe this problem affects tornado 
(<a href="https://github.com/tornadoweb/tornado/issues/1110">https://github.com/tornadoweb/tornado/issues/1110</a>), Scrapy (this is how
 I became aware of this issue), NLTK (anecdotical evidence - I tried to port some hairy NLTK module 
to io.BytesIO, it became many times slower) and maybe pretty much every 
IO-related project ported to Python 3.x (django - <a href="https://github.com/django/django/blob/fff7b507ef2f85bb47abd2ee32982682d7822ac4/django/http/request.py#L225">check</a>, werkzeug and frameworks based on it - <a href="https://github.com/mitsuhiko/werkzeug/blob/976b63cadf3d5482aa975df053fa458ff638e571/werkzeug/wrappers.py#L375">check</a>, requests - <a href="https://github.com/kennethreitz/requests/blob/6b21e5c8f0c8fafda661d80f4555ce530507bd68/requests/models.py">check</a> - they all wrap user data to BytesIO, and this may cause slowdowns and up to 2x memory usage in Python 3.x).<br><br>
</div>Do you know if there a workaround? Maybe there is some stdlib part that I'm missing, or a module on PyPI? It is not that hard to write an own wrapper that won't do copies (or to port [c]StringIO to 3.x), but I wonder if there is an existing solution or plans to fix it in Python itself - this BytesIO use case looks quite important.<br>
</div></div>
Ben Hoyt | 15 Jul 14:19 2014
Picon

Re: Remaining decisions on PEP 471 -- os.scandir()

> I'd *keep DirEntry.lstat() method* regardless of existence of
> .stat(*, follow_symlinks=True) method (despite the slight violation of
> DRY principle) for readability. `dir_entry.lstat().st_mode` is more
> consice than `dir_entry.stat(follow_symlinks=False).st_mode` and the
> meaning of lstat is well-established -- get (symbolic link) status [2].

The meaning of lstat() is well-established, so I don't mind this. But
I don't think it's necessary, either. My thought would be that in new
code/functions we should kind of prescribe best-practices rather than
leave the options open. Yes, it's a few more characters, but
"follow_symlinks=True" is allow much clear than "l" to describe this
behaviour, especially for non-Linux hackers.

> I suggest *renaming .full_name -> .path* due to reasons outlined in [1].
>
> [1]: https://mail.python.org/pipermail/python-dev/2014-July/135441.html

Hmmm, perhaps. You suggest .full_name implies it's the absolute path,
which isn't true. I don't mind .path, but it kind of sounds like "the
Path object associated with this entry". I think "full_name" is fine
-- it's not "abs_name".

> follow_symlinks (if added) should be *keyword-only parameter* because
> `dir_entry.is_dir(False)` is unreadable (it is not clear at a glance
> what `False` means in this case).

Agreed follow_symlinks should be a keyword-only parameter (as it is in
os.stat() in Python 3).

> Exceptions are part of the public API. pathlib is inconsitent with
> os.path here e.g., os.path.isdir() ignores all OS errors raised by
> the stat() call but the corresponding pathlib call ignores only broken
> symlinks (non-existent entries).
>
> The cherry-picking of which stat errors to silence (implicitly) seems
> worse than either silencing the errors (like os.path.isdir does) or
> allowing them to propagate.

Hmmm, you're right there's a subtle difference here. I think the
os.path.isdir() behaviour could mask real errors, and the pathlib
behaviour is more correct. pathlib's behaviour is not implicit though
-- it's clearly documented in the docs:
https://docs.python.org/3/library/pathlib.html#pathlib.Path.is_dir

> Returning False instead of raising OSError in is_dir() method simplifies
> the usage greatly without (much) negative consequences. It is a *rare*
> case when silencing errors could be more practical.

I think is_X() *should* fail if there are permissions errors or other
fatal errors. Whether or not they should fail if the file doesn't
exist (unlikely to happen anyway) or on a broken symlink is a
different question, but there's a good prececent with the existing
os/pathlib functions there.

-Ben
Ethan Furman | 14 Jul 18:16 2014
Picon

Python Job Board

has now been dead for five months.

--
~Ethan~

Gmane