[issue18813] Speed up slice object processing

2014-11-16 Thread Stefan Behnel
Stefan Behnel added the comment: Here's another idea. There could be two implementations of slice, one that uses Python object indices (as currently) and one that has Py_ssize_t indices (and properties for the start/stop/step attributes). Similar to what Unicode strings do, the slice type

[issue22880] hmac.new docs show optional args incorrectly

2014-11-16 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the report, but the signature is correct. From https://docs.python.org/devguide/documenting.html#information-units The signature should include the parameters, enclosing optional parameters in brackets. See also

[issue18813] Speed up slice object processing

2014-11-16 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks for the review, Serhiy. There isn't really a reason not to 'normalise' the Python step object to None when 1 is passed from C code, so I updated the patch to do that. Regarding on-demand creation of the Python values, the problem is that C code that

[issue18813] Speed up slice object processing

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There could be two implementations of slice, one that uses Python object indices (as currently) and one that has Py_ssize_t indices (and properties for the start/stop/step attributes). Agree, this idea LGTM. Single boolean flag should be enough to switch

[issue22881] show median in benchmark results

2014-11-16 Thread Stefan Behnel
New submission from Stefan Behnel: The median tends to give a better idea about benchmark results than an average as it inherently ignores outliers. -- components: Benchmarks files: show_median.patch keywords: patch messages: 231239 nosy: pitrou, scoder priority: normal severity:

[issue22881] show median in benchmark results

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In case of even number of samples the median value is calculated as arithmetic mean of two middle samples. med_base = (base_times[len(base_times)//2] + base_times[(len(base_times)+1)//2]) / 2 -- nosy: +serhiy.storchaka stage: - patch review

[issue22881] show median in benchmark results

2014-11-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- Removed message: http://bugs.python.org/msg231240 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22881 ___

[issue22881] show median in benchmark results

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In case of even number of samples the median value is calculated as arithmetic mean of two middle samples. med_base = (base_times[len(base_times)//2] + base_times[(len(base_times)-1)//2]) / 2 -- ___ Python

[issue17293] uuid.getnode() MAC address on AIX

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, socket.gaierror was not made an alias of OSError, only subclass of it. Well, we can apply the same patch to all releases. Does it fix tests? -- ___ Python tracker rep...@bugs.python.org

[issue22881] show median in benchmark results

2014-11-16 Thread Stefan Behnel
Stefan Behnel added the comment: Fair enough, patch updated. -- Added file: http://bugs.python.org/file37207/show_median.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22881 ___

[issue18813] Speed up slice object processing

2014-11-16 Thread Stefan Behnel
Stefan Behnel added the comment: I reran the benchmarks with the fast path in _PyEval_SliceIndex() and the results are not conclusive. There is no clear indication that it improves the performance. The problem is that most slices have no step, many slices are open ended on at least one side

[issue22882] [patch] Linux packages you need to compile Python with all dependencies

2014-11-16 Thread Ludovic Gasc
New submission from Ludovic Gasc: Hi, To install easily Python 3.4.2 on Linux, I use Pythonz: http://saghul.github.io/pythonz/ I've discovered that, depends on the packages already installed on Linux, I don't have the same Python each time after compilation on servers. Some features could

[issue22883] Get rid of references to PyInt in Py3 sources

2014-11-16 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: There are several references to PyInt in outdated comments in .c and .h files: $ find * -name '*.[ch]' -exec egrep -n --color -- 'PyInt\b' '{}' + Include/longobject.h:34:/* It may be useful in the future. I've added it in the PyInt - PyLong

[issue18813] Speed up slice object processing

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Indeed, PySequence_GetSlice() is used only in few performance non-critical places in the stdlib, PySequence_Set/DelSlice() are not used at all. So looks as this way doesn't speed up any code. As for faster_PyEval_SliceIndex.patch see issue17576. May be such

[issue22599] traceback: errors in the linecache module at exit

2014-11-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - haypo dependencies: +Add a function to know about interpreter shutdown type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22599

[issue22696] Add a function to know about interpreter shutdown

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm +0 for is_finalizing. There is a typo in the docstring. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22696 ___

[issue22884] argparse.FileType.__call__ returns unwrapped sys.stdin and stdout

2014-11-16 Thread Kevin Orr
New submission from Kevin Orr: When one uses a file object returned by `FileType.__call__` as a context manager, `sys.stdin`'s or `sys.stdout`'s `__exit__` will be triggered upon exit of the context, in turn calling their `close` method. Perhaps the issue is that `sys.stdin` and `sys.stdout`

[issue17611] Move unwinding of stack for pseudo exceptions from interpreter to compiler.

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I like the idea. I have not make faultfinding review yet, but one thing is questionable to me. Is it necessary to get rid of the END_FINALLY opcode? Currently Python code try: stmt1 finally: stmt2 is compiled to: SETUP_FINALLY

[issue22884] argparse.FileType.__call__ returns unwrapped sys.stdin and stdout

2014-11-16 Thread Kevin Orr
Kevin Orr added the comment: Hmm, not sure why I thought I needed `inline code formatting`. It's all monospace anyway! Anyway, I'm thinking that adding this somewhere in argparse.py: class _WrappedIO(object): def __init__(self, fileobj): self._file = fileobj def __exit__(tp,

[issue22880] hmac.new docs show optional args incorrectly

2014-11-16 Thread R. David Murray
R. David Murray added the comment: To be clear: this was/is the python2 documentation style. In python3 we've switched to using keyword argument notation in functions that support specifying optional arguments via keyword (which is many more of the C functions than in python2). --

[issue22882] [patch] Linux packages you need to compile Python with all dependencies

2014-11-16 Thread R. David Murray
R. David Murray added the comment: I don't think it is a good idea for us to try to track which packages are needed and what they are named by the various downstreams. We could document the optional modules by project name, though. Note also that the devguide does point to the umbrella

[issue22884] argparse.FileType.__call__ returns unwrapped sys.stdin and stdout

2014-11-16 Thread R. David Murray
R. David Murray added the comment: Perhaps instead it could return an io object built from the file descriptor with closefd=False. -- nosy: +r.david.murray versions: +Python 3.4, Python 3.5 -Python 2.7, Python 3.6 ___ Python tracker

[issue22885] Arbitrary code execution vulnerability due to unchecked eval() call in dumbdbm module

2014-11-16 Thread Stephen Farris
New submission from Stephen Farris: The dumbdbm module uses an unchecked call to eval() in the _update method, which is called in response to a call to dumbdbm.open(), and is used to load the index from the directory file.  This poses a security vulnerability because it allows an attacker to

[issue18813] Speed up slice object processing

2014-11-16 Thread Stefan Behnel
Stefan Behnel added the comment: why you pass through fast path only if -1= Py_SIZE(v) =1? It's usually enough, it's the fastest fast path, and it doesn't even need error handling. Any slicing where the slice calculation time matters is going to be of fairly limited size, often involving the

[issue22882] [patch] Linux packages you need to compile Python with all dependencies

2014-11-16 Thread Ludovic Gasc
Ludovic Gasc added the comment: I'm not agree with you: I've lost a lot of time to find all packages I need for that, I've merged information from several blog posts. I imagine that I'm not alone with this problem. If you move this information in devguide, most persons don't find this.

[issue22882] [patch] Linux packages you need to compile Python with all dependencies

2014-11-16 Thread Andrew Svetlov
Andrew Svetlov added the comment: For Ubuntu/debian you can just run: $ sudo apt-get build-dep python3 -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22882 ___

[issue22882] [patch] Linux packages you need to compile Python with all dependencies

2014-11-16 Thread Ludovic Gasc
Ludovic Gasc added the comment: $ sudo apt-get build-dep python3 Good to know, I will test for my next deployment. The only problem with that, if you use a old Debian with a Python3 that need less dependencies that actual version. But you can add a line for that in documentation if we have

[issue22876] ip_interface can't be broadcast or number net

2014-11-16 Thread Nick Coghlan
Nick Coghlan added the comment: The Interface classes are actually designed to cover any association of an IP address with a specific network, not just host interface addresses. We knew it was a slight misnomer when we chose it, but network and broadcast addresses weren't considered special

[issue22886] TestProgram leaves defaultTestLoader.errors dirty

2014-11-16 Thread Robert Collins
New submission from Robert Collins: TestProgram leaves defaultTestLoader.errors dirty. This primarily affects tests but it would be good hygiene to clear it at the end of TestProgram. -- components: Library (Lib) messages: 231261 nosy: rbcollins priority: normal severity: normal

[issue22888] ensurepip and distutils' build_scripts fails on Windows when path to Python contains accented characters

2014-11-16 Thread José Alberto Goncalves
New submission from José Alberto Goncalves: Summary: Python 3.4's venv works fine in Windows, and pip works fine when installing both pure Python libraries and extension modules. However, when the virtual environment is under a path with non-ASCII characters, attempting to install a package

[issue22887] ensurepip and distutils' build_scripts fails on Windows when path to Python contains accented characters

2014-11-16 Thread José Alberto Goncalves
New submission from José Alberto Goncalves: Summary: Python 3.4's venv works fine in Windows, and pip works fine when installing both pure Python libraries and extension modules. However, when the virtual environment is under a path with non-ASCII characters, attempting to install a package

[issue22887] ensurepip and distutils' build_scripts fails on Windows when path to Python contains accented characters

2014-11-16 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- resolution: - duplicate stage: - resolved status: open - closed superseder: - ensurepip and distutils' build_scripts fails on Windows when path to Python contains accented characters ___ Python

[issue17293] uuid.getnode() MAC address on AIX

2014-11-16 Thread koobs
koobs added the comment: I don't have the environment to test here. Can you run a custom build on the buildbots? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17293 ___

[issue22882] [patch] Linux packages you need to compile Python with all dependencies

2014-11-16 Thread R. David Murray
R. David Murray added the comment: The fact that it cost you a lot of time buttresses my point. Any documentation we write is likely to get stale; it is only the downstream that knows when these things change and could maintain such a document. And the easy answer is as Andrew indicated,

[issue22882] [patch] Linux packages you need to compile Python with all dependencies

2014-11-16 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- versions: -Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22882 ___ ___

[issue22885] Arbitrary code execution vulnerability due to unchecked eval() call in dumbdbm module

2014-11-16 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22885 ___ ___

[issue22882] Document Linux packages you need to compile Python with all dependencies

2014-11-16 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- title: [patch] Linux packages you need to compile Python with all dependencies - Document Linux packages you need to compile Python with all dependencies ___ Python tracker rep...@bugs.python.org

[issue22889] set a timeout for DNS lookups

2014-11-16 Thread Kevin Burke
New submission from Kevin Burke: It would be nice to be able to set a timeout for DNS lookups in the event of a DNS server failure. 1. Set your DNS to something like 123.123.123.123 or any other host that is not listening for DNS queries on port 53. 2. Run requests.get('http://jsonip.com',

[issue22888] ensurepip and distutils' build_scripts fails on Windows when path to Python contains accented characters

2014-11-16 Thread eryksun
eryksun added the comment: On Windows, shouldn't copy_scripts use UTF-8 instead of os.fsencode (MBCS)? The Python launcher executes the shebang line on Windows, and it defaults to UTF-8 if a script doesn't have a BOM. See line 1105 in maybe_handle_shebang:

[issue22890] StringIO.StringIO pickled in 2.7 is not unpickleable on 3.x

2014-11-16 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: StringIO.StringIO is pickleable and unpickleable on 2.7 but is not unpickleable on 3.x. Python 2.7: import pickle, StringIO pickle.dumps(StringIO.StringIO('abc'), 2)

[issue18473] some objects pickled by Python 3.x are not unpicklable in Python 2.x because of incorrect REVERSE_IMPORT_MAPPING

2014-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which fixes multiple reversible mappings. Mappings for StringIO and cStringIO is removed at all because cStringIO.StringIO is not pickleable on 2.7 at all and pickled StringIO.StringIO is not compatible with 3.x (issue22890). --

[issue18473] some objects pickled by Python 3.x are not unpicklable in Python 2.x because of incorrect REVERSE_IMPORT_MAPPING

2014-11-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18473 ___ ___