[Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
sion$ Last-Modified: $Date$ Author: Victor Stinner Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 4-January-2016 Python-Version: 3.6 Abstract Add a new private version to the builtin ``dict`` type, incremented at each dictionary creation and at each dictionary change, to

Re: [Python-Dev] MAKE_FUNCTION simplification

2016-04-14 Thread Victor Stinner
2016-04-14 11:04 GMT+02:00 Nikita Nemkin : > MAKE_FUNCTION opcode is complex due to the way it receives > input arguments: (...) Yeah, I was always disturbed how this opcode gets parameters. > My suggestion is to pre-package 1-4 before calling MAKE_FUNCTION, > i.e. explicitly emit BUILD_TUPLE for

Re: [Python-Dev] MAKE_FUNCTION simplification

2016-04-14 Thread Victor Stinner
2016-04-14 17:27 GMT+02:00 Guido van Rossum : > Great analysis! What might stand in the way of adoption is concern for > bytecode manipulation libraries that would have to be changed. > (...) > There's also talk of switching to wordcode, in a different thread. I agree that breaking backward compat

Re: [Python-Dev] pathlib - current status of discussions

2016-04-14 Thread Victor Stinner
2016-04-14 16:54 GMT+02:00 Ethan Furman : >> I consider that the final goal of the whole discussion is to support >> something like: >> >> path = os.path.join(pathlib_path, "str_path", direntry) >> >> (...) >> I expect that DirEntry.__fspath__ uses os.fsdecode() to return str, >> just to make

Re: [Python-Dev] pathlib - current status of discussions

2016-04-14 Thread Victor Stinner
2016-04-14 17:29 GMT+02:00 Ethan Furman : > Interoperability with other systems and/or libraries. If we use > surrogateescape to transform str to bytes, and the other side does not, we > no longer have a workable path. I guess that you mean a Python library? When you exchange with external progra

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
2016-04-14 18:28 GMT+02:00 Brett Cannon : > +1 from me! Thanks. > A couple of grammar/typo suggestions below. Fixed. (Yes, I want to use unsigned type, so PY_UINT64_T.) Victor ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/m

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
écrit : > I'll wait a day before formally pronouncing to see if any objections > are made, but it looks good to me. > > On Thu, Apr 14, 2016 at 8:19 AM, Victor Stinner > > wrote: > > Hi, > > > > I updated my PEP 509 to make the dictionary version globall

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
jeudi 14 avril 2016, Stefan Behnel a écrit : > +1 from me, too. I'm sure we can make some use of this in Cython. > > Stefan > > > Victor Stinner schrieb am 14.04.2016 um 17:19: > > PEP: 509 > > Title: Add a private version to dict > > >

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
Hi, 2016-04-14 22:42 GMT+02:00 Armin Rigo : > Hi Victor, > > On 14 April 2016 at 17:19, Victor Stinner wrote: >> Each time a dictionary is created, the global >> version is incremented and the dictionary version is initialized to the >> global version. > > A de

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
2016-04-14 22:50 GMT+02:00 Barry Warsaw : > Although I'm not totally convinced, I won't continue to object. You've > provided some performance numbers in the PEP even without FAT, and you aren't > exposing the API to Python, so it's not a burden being imposed on other > implementations. Cool! Ah

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
2016-04-14 23:29 GMT+02:00 Barry Warsaw : > I can see why you might want a global version number, but not doing so would > eliminate an implicit reliance on the GIL, or in a GIL-less implementation > a lock around incrementing the global version number. It's not like the builtin dict type is goin

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-14 Thread Victor Stinner
2016-04-15 0:22 GMT+02:00 Brett Cannon : > And even if it was GIL-free you do run the risk of two dicts ending up at > the same version # by simply mutating the same number of times if the > counters were per-dict instead of process-wide. For some optimizations, it is not needed to check if the di

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-15 Thread Victor Stinner
Le vendredi 15 avril 2016, Stefan Behnel a écrit : > How can that be achieved? If the tag is just a sequentially growing number, > creating two dicts and applying one operation to the first one should give > both the same version tag, right? > Armin didn't propose to get ride of the global versi

Re: [Python-Dev] Should secrets include a fallback for hmac.compare_digest?

2016-04-15 Thread Victor Stinner
It's easy to implement this function (in the native language of your Python implemenation), it's short. I'm not sure that a Python version is really safe. The secrets module is for Python 3.6, in this version the hmac already "requires" the compare_digest() function no? Victor ___

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-15 Thread Victor Stinner
2016-04-15 11:01 GMT+02:00 Antoine Pitrou : > Victor Stinner gmail.com> writes: >> You're right that incrementing the global version is useless for these >> specific cases, and using the version 0 should work. It only matters >> that the version (version? version t

Re: [Python-Dev] PEP 506 secrets module

2016-04-15 Thread Victor Stinner
Hi, Would it make sense to add a function to generate a random UUID4 (as a string) in secrets? The current implement in uuid.py of CPython 3.6 already uses os.urandom(): def uuid4(): """Generate a random UUID.""" return UUID(bytes=os.urandom(16), version=4) Victor __

Re: [Python-Dev] Should secrets include a fallback for hmac.compare_digest?

2016-04-15 Thread Victor Stinner
2016-04-15 11:21 GMT+02:00 Steven D'Aprano : > This isn't just a question about the secrets module. PEP 399 suggests > than any C classes/functions should have a pure Python version as > fallback, but compare_digest doesn't. I don't know whether it should or > not. The hmac module is responsible t

Re: [Python-Dev] PEP 8 updated on whether to break before or after a binary update

2016-04-15 Thread Victor Stinner
Hum. if (width == 0 and height == 0 and color == 'red' and emphasis == 'strong' or highlight > 100): raise ValueError("sorry, you lose") Please remove one space to vertically align "and" operators with the opening parenthesis:

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-15 Thread Victor Stinner
2016-04-15 19:54 GMT+02:00 Jim J. Jewett : > (1) Meta Question: If this is really only for CPython, then is > "Standards Track" the right classification? Yes, I think so. It doesn't seem to be an Informal nor a Process: https://www.python.org/dev/peps/pep-0001/#pep-types > (2) Why *promise* n

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-15 Thread Victor Stinner
2016-04-15 23:07 GMT+02:00 Random832 : > Why is iterating over items different from iterating over keys? > > in other words, why do I have to write: > > for k in dict: > v = dict[k] > ...do some stuff... > dict[k] = something > > rather than > > for k, v in dict.items(): > ...do som

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-15 Thread Victor Stinner
2016-04-15 23:16 GMT+02:00 Ethan Furman : >> It's an useful property. For example, let's say that you have a guard >> on globals()['value']. The guard is created with value=3. An unit test >> replaces the value with 50, but then restore the value to its previous >> value (3). Later, the guard is ch

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-15 Thread Victor Stinner
Hi, FYI I updated the implementation of the PEP 509: https://bugs.python.org/issue26058 2016-04-15 11:01 GMT+02:00 Antoine Pitrou : > Why do this? It's a nice property that two dicts always have different > version tags, and now you're killing this property for... no obvious > reason? > > Do you

Re: [Python-Dev] RFC: PEP 509: Add a private version to dict

2016-04-15 Thread Victor Stinner
.2016-04-15 23:45 GMT+02:00 Jim J. Jewett : >> It's an useful property. For example, let's say that you have a guard >> on globals()['value']. The guard is created with value=3. An unit test >> replaces the value with 50, but then restore the value to its previous >> value (3). Later, the guard is

Re: [Python-Dev] My first post here ~ do you need more Python core developers on Windows?

2016-04-18 Thread Victor Stinner
2016-04-18 7:23 GMT+02:00 Burkhard Meier : > My name is Burkhard Meier and I wrote the "Python GUI Programming Cookbook" > published by Packt. > > It is available on Amazon and PacktPub.com. Welcome! > Maybe I can become more involved in the Python community as a Python > developer on Windows .

[Python-Dev] PEP 509: Add a private version to dict (version 3)

2016-04-19 Thread Victor Stinner
ests on equal values. HTML version: https://www.python.org/dev/peps/pep-0509/ PEP: 509 Title: Add a private version to dict Version: $Revision$ Last-Modified: $Date$ Author: Victor Stinner Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 4-January-2016 Python-Version: 3.6 A

Re: [Python-Dev] PEP 509: Add a private version to dict (version 3)

2016-04-19 Thread Victor Stinner
Hi, > Backwards Compatibility > === > > Since the ``PyDictObject`` structure is not part of the stable ABI and > the new dictionary version not exposed at the Python scope, changes are > backward compatible. My current implementation inserts the new ma_version_tag field in the

Re: [Python-Dev] Modify PyMem_Malloc to use pymalloc for performance

2016-04-19 Thread Victor Stinner
multiple Python extensions written in C. I only found one bug in numpy and I sent a patch (not merged yet). victor 2016-03-15 0:19 GMT+01:00 Victor Stinner : > 2016-02-12 14:31 GMT+01:00 M.-A. Lemburg : >>>> If your program has bugs, you can use a debug build of Python 3.5 to &

[Python-Dev] Discussion on fspath: please wait for a PEP

2016-04-20 Thread Victor Stinner
Hi, I'm unable to count the number of threads about the fspath protocol. It's even more difficult to count the total number of emails. IMHO everyone had enough time to give him/her opinion. We even had multiple summaries :-) Can you please wait for a PEP? Brett Canon and Ethan Furman are working

Re: [Python-Dev] Discussion on fspath: please wait for a PEP

2016-04-20 Thread Victor Stinner
Hi, 2016-04-20 18:12 GMT+02:00 Brett Cannon : >> >> Can you please wait for a PEP? Brett Canon and Ethan Furman are >> >> working on a PEP. > > I was actually going to send this email when I got in to work today, but > Victor and timezones beat me to it. :) Ha ha, bitten by the french connection!

Re: [Python-Dev] PEP 509: Add a private version to dict (version 3)

2016-04-20 Thread Victor Stinner
Hi, Guido van Rossum and Jim J. Jewett suggested me to *not require* to always increase the dict version if a dict method does not modify its content. I modified the Changes section to only require that the version is increased when the dictionary content is modified. I also explained the nice si

Re: [Python-Dev] Modify PyMem_Malloc to use pymalloc for performance

2016-04-22 Thread Victor Stinner
, socket, etc. were allocated on ResourceWarning: https://docs.python.org/dev/whatsnew/3.6.html#warnings It looks like Python 3.6 will help developers ;-) Victor 2016-04-20 1:33 GMT+02:00 Victor Stinner : > Ping? Is someone still opposed to my change #26249 "Change > PyMem_Malloc to u

Re: [Python-Dev] Wordcode: new regular bytecode using 16-bit units

2016-04-24 Thread Victor Stinner
Hi Raymond, 2016-04-24 21:45 GMT+02:00 Raymond Hettinger : > I think the word code patch should go in sooner rather than later. Several > of us have been through the patch and it is in pretty good shape (some parts > still need work though). The earlier this goes in, the more time we'll have

Re: [Python-Dev] Wordcode: new regular bytecode using 16-bit units

2016-04-24 Thread Victor Stinner
2016-04-24 23:16 GMT+02:00 Raymond Hettinger : >> On Apr 24, 2016, at 1:16 PM, Victor Stinner wrote: >> I proposed to not try to optimize ceval.c to fetch (oparg, opval) in a >> single 16-bit operation. It should be easy to implement it later, but >> I prefer to focus o

Re: [Python-Dev] Wordcode: new regular bytecode using 16-bit units

2016-05-06 Thread Victor Stinner
Oh nice. Did you see my recent "bytecode" project? http://bytecode.readthedocs.io/ Victor Le 5 mai 2016 8:30 PM, a écrit : > Here is something I wrote because I was also unsatisfied with byteplay's > API: https://github.com/zachariahreed/byteasm. Maybe it's useful in a > discussion of "minimum v

[Python-Dev] Buildbots now always run tests in subprocesses

2016-05-20 Thread Victor Stinner
Hi, I modified regrtest to not ignore -j1 anymore (issue #25285). I also modified Tools/buildbot/test.bat to add the -j1 option (-j1 was already used on UNIX on "make buildbottest"). All buildbots will now run each test file in a fresh subprocess. It helps to restrict all kinds of side effects of

Re: [Python-Dev] Removing the provisional label from pathlib

2016-05-20 Thread Victor Stinner
2016-05-20 18:56 GMT+02:00 Guido van Rossum : > Let's start in 3.6 with all this. I added path to 3.4 because I didn't > realize it was in security-mode only. I also had to ask the question to myself about branches, that's why I wrote this table ;-) https://docs.python.org/devguide/#status-of-pyth

Re: [Python-Dev] New hash algorithms: SHA3, SHAKE, BLAKE2, truncated SHA512

2016-05-27 Thread Victor Stinner
Le 27 mai 2016 12:05 PM, "Donald Stufft" a écrit : > BLAKE2 is an interesting one, because while SHA3 is a NIST standard (so it’s going to gain adoption because of that), BLAKE2 is at least as strong as SHA3 but is better in many ways, particularly in speed— it’s actually faster than MD5 while bei

Re: [Python-Dev] New hash algorithms: SHA3, SHAKE, BLAKE2, truncated SHA512

2016-05-27 Thread Victor Stinner
Le vendredi 27 mai 2016, M.-A. Lemburg a écrit : > > The curent patch is 1.2MB for SHA-3 - that's pretty heavy for just > a few hash functions, which aren't in any wide spread use yet and > probably won't be for quite a few years ahead. Oh wow, it's so fat? Why is it so big? Can't we use a light

Re: [Python-Dev] New hash algorithms: SHA3, SHAKE, BLAKE2, truncated SHA512

2016-05-28 Thread Victor Stinner
Python 3.5 requires a 64 bit signed integer to build. Search for _PyTime type in pytime.h ;-) ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/pytho

Re: [Python-Dev] C99

2016-06-07 Thread Victor Stinner
Hi, 2016-06-04 19:47 GMT+02:00 Guido van Rossum : > Funny. Just two weeks ago I was helping someone who discovered a > compiler that doesn't support the new relaxed variable declaration > rules. I think it was on Windows. Maybe this move is a little too > aggressively deprecating older Windows com

Re: [Python-Dev] PEP 454 (tracemalloc): new minimalist version

2013-10-18 Thread Victor Stinner
2013/10/18 Charles-François Natali : > I'm happy to see this move forward! Thanks for your reviews. I had some time in my train travel to improve the implementation. I removed the call to pthread_atfork(): tasks have been removed, it now makes sense to keep tracemalloc enabled in the child proces

Re: [Python-Dev] cpython: Issue #18582: provide a faster C implementation of pbkdf2_hmac that works with

2013-10-19 Thread Victor Stinner
Does Python officially support opsenssl < 1.0? Which OS uses such old version? On Windows, Python embeds its own copy of openssl for example. Victor Le 19 oct. 2013 18:07, "Christian Heimes" a écrit : > Am 19.10.2013 16:59, schrieb Antoine Pitrou: > > But that's a fringe situation. Any normal b

Re: [Python-Dev] [python-committers] I *might* push Python 3.4.0 alpha 4 back a week

2013-10-19 Thread Victor Stinner
2013/10/19 Larry Hastings : > A lot has landed in trunk in the last day or two: Tulip, Argument Clinic, > and statistics just landed too. Wow, Python 3.4 looks great! I was waiting for statistics. Don't forget to update the What's New in Python 3.4 document. Victor __

Re: [Python-Dev] PEP 454 (tracemalloc): new minimalist version

2013-10-20 Thread Victor Stinner
2013/10/19 Charles-François Natali : >> get_object_trace(obj) is a shortcut for >> get_trace(get_object_address(obj)). I agree that the wrong size >> information can be surprising. >> >> I can delete get_object_trace(), or rename the function to >> get_object_traceback() and modify it to only retur

Re: [Python-Dev] [Python-checkins] cpython: Switch subprocess stdin to a socketpair, attempting to fix issue #19293 (AIX

2013-10-22 Thread Victor Stinner
Hi, Would it be possible to use os.pipe() on all OSes except AIX? Pipes and socket pairs may have minor differences, but some applications may rely on these minor differences. For example, is the buffer size the same? For example, in test.support, we have two constants: PIPE_MAX_SIZE (4 MB) and S

Re: [Python-Dev] [Python-checkins] cpython: Switch subprocess stdin to a socketpair, attempting to fix issue #19293 (AIX

2013-10-23 Thread Victor Stinner
"For the record, pipe I/O seems a little faster than socket I/O under Linux" In and old (2006) email on LKML (Linux kernel), I read: "as far as I know pipe() is now much faster than socketpair(), because pipe() uses the zero-copy mechanism." https://lkml.org/lkml/2006/9/24/121 On Linux, splice()

[Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-23 Thread Victor Stinner
memory allocations Version: $Revision$ Last-Modified: $Date$ Author: Victor Stinner Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 3-September-2013 Python-Version: 3.4 Abstract This PEP proposes to add a new ``tracemalloc`` module to trace memory blocks allocated

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-23 Thread Victor Stinner
Hi, 2013/10/23 Kristján Valur Jónsson : > This might be a good place to make some comments. > I have discussed some of this in private with Victor, but wanted to make them > here, for the record. Yes, I prefer to discuss the PEP on python-dev. It's nice to get more feedback, I expect to get a be

Re: [Python-Dev] OS X 10.9 Mavericks -> 2.7.6/3.3.3 updates needed

2013-10-24 Thread Victor Stinner
2013/10/24 Christian Heimes : > There seems to be a problem with the security fix "Re-seed OpenSSL's > PRNG after fork": > > http://bugs.python.org/issue18747 > http://bugs.python.org/issue19227 Yes, Charles Francois warned us that adding a pthread_atfork() hook to add entropy may add a deadlo

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-24 Thread Victor Stinner
2013/10/24 Kristján Valur Jónsson : >> Test 1. With the Python test suite, 467,738 traces limited to 1 frame: > ... >> I'm surprised: it's faster than the benchmark I ran some weeks ago. >> Maybe I optimized something? The most critical operation, taking a snapshot >> takes half a second, so it's e

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-24 Thread Victor Stinner
> When I was looking for memory leaks in the regex module I simply wrote all of the allocations, reallocations and deallocations to a log file and then parsed it afterwards using a Python script. Simple, but effective. He he, it's funny because you described exactly my first implementation of trac

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-27 Thread Victor Stinner
I updated the PEP according to different comments: * replace Snapshot.create() class method with take_snapshot() function * get_traces() now returns a list instead of a dict (remove addresses) * remove get_stats() * unknown frames are now stored as ("", 0) instead of (None, None) * remove get_obje

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-27 Thread Victor Stinner
Hum, timestamp and traceback_limit attributed of GroupedStats can also be removed, they are just of the same attribute of the Snapshot class and GroupedStats is created from Snapshot.group_by(). Le 27 oct. 2013 17:26, "Victor Stinner" a écrit : > * do you have a better s

[Python-Dev] Block module import during Python finalization?

2013-10-28 Thread Victor Stinner
Hi, While working on a fix, I got an assertion error during Python finalization because Python tried to import the "io" module whereas the module was just unloaded. Python tried to import the io module to display a warning and display the Python line where the warning was emitted. See the followin

Re: [Python-Dev] PEP 455: TransformDict

2013-10-28 Thread Victor Stinner
2013/10/4 Raymond Hettinger : >> On Sep 22, 2013, at 6:16 PM, Ethan Furman wrote: >> > Are we close to asking for pronouncement? > > When you're ready, let me know. The deadline for new features is in less than 1 month, so what is the status of the PEP 455 (TransformDict)? Victor ___

Re: [Python-Dev] cpython: Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle

2013-10-29 Thread Victor Stinner
2013/10/29 Georg Brandl : > Am 29.10.2013 01:19, schrieb victor.stinner: >> http://hg.python.org/cpython/rev/4ef4578db38a >> changeset: 86715:4ef4578db38a >> user: Victor Stinner >> date:Tue Oct 29 01:19:37 2013 +0100 >> summ

Re: [Python-Dev] cpython: Issue #18408: Fix PyUnicode_AsUTF8AndSize(), raise MemoryError exception on

2013-10-29 Thread Victor Stinner
2013/10/29 Georg Brandl : >> diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c >> --- a/Objects/unicodeobject.c >> +++ b/Objects/unicodeobject.c >> @@ -3766,6 +3766,7 @@ >> return NULL; >> _PyUnicode_UTF8(unicode) = PyObject_MALLOC(PyBytes_GET_SIZE(bytes) >> + 1)

Re: [Python-Dev] PEP 454 (tracemalloc) disable ==> clear?

2013-10-29 Thread Victor Stinner
2013/10/29 Jim Jewett : > reset() function: > > Clear traces of memory blocks allocated by Python. > > Does this do anything besides clear? If not, why not just re-use the > 'clear' name from dicts? (I like the reset() name. Charles-François suggested this name inspired by OProfile AP

[Python-Dev] tracemalloc.get_object_traceback() and "unclosed" ResourceWarning

2013-10-29 Thread Victor Stinner
Hi, Since Python 3.3, when a file or socket object is destroyed before being closed, a ResourceWarning is emitted. The warning is emitted where the object is destroyed: it's common to see "gc.collect()" location in the Python test suite for example. Tarek Ziadé asked on Twitter if there is a tool

Re: [Python-Dev] tracemalloc.get_object_traceback() and "unclosed" ResourceWarning

2013-10-29 Thread Victor Stinner
2013/10/29 Nick Coghlan : > I was thinking you could turn on warnings->errors and then catch the > exception, and use that to get hold of the original object that > triggered the resource warning, and then fed *that* into > tracemalloc.get_object_traceback(). But, alas, even if we tweaked > Resourc

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-29 Thread Victor Stinner
2013/10/26 Kristján Valur Jónsson : > In that case, how about adding a client/server feature? > > If you standardize the format, a minimal tracing client could write a log, > or send it to a socket, in a way that can be turned into a snapshot by a > corresponsing utility reading from a file or list

Re: [Python-Dev] PEP 454 (tracemalloc) disable ==> clear?

2013-10-30 Thread Victor Stinner
Hi, 2013/10/30 Jim J. Jewett : > Well, unless I missed it... I don't see how to get anything beyond > the return value of get_traces, which is a (time-ordered?) list > of allocation size with then-current call stack. It doesn't mention > any attribute for indicating that some entries are de-alloc

Re: [Python-Dev] PEP 454 (tracemalloc) disable ==> clear?

2013-10-30 Thread Victor Stinner
2013/10/30 Stephen J. Turnbull : > Just "reset" implies to me that you're ready to start over. Not just > traced memory blocks but accumulated statistics and any configuration > (such as Filters) would also be reset. Also tracing would be disabled > until started explicitly. If the name is reall

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-30 Thread Victor Stinner
2013/10/30 Kristján Valur Jónsson : > The point of a PEP is getting something into standard python. The command > line flag is also part of this. > Piggybacking a lightweight client/server data-gathering version of this on > top of the PEP > could be beneficial in that respect. In my opinion, y

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-30 Thread Victor Stinner
> Snapshot > > > ``Snapshot(timestamp: datetime.datetime, traceback_limit: int, stats: > dict=None, traces: dict=None)`` class: > > Snapshot of statistics and traces of memory blocks allocated by > Python. > > ``apply_filters(filters)`` method: > > Apply filters on the ``traces

Re: [Python-Dev] PEP 454 (tracemalloc) disable ==> clear?

2013-10-30 Thread Victor Stinner
Le 30 oct. 2013 20:58, "Jim Jewett" a écrit : > hough if you use a dict internally, that might not > be the case. Tracemalloc uses a {address: trace} duct internally. > If you return it as a list instead of a dict, but that list is > NOT in time-order, that is worth documenting Ok i will docum

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-30 Thread Victor Stinner
New update of the PEP combining various remarks: * Remove GroupedStats class and Snapshot.group_by(): replaced with a new Snapshot.statistics() method which combines all features * Rename reset() to clear_traces() and explain how to get traces before clearing traces * Snapshot.apply_filters() now

Re: [Python-Dev] Updated PEP 454 (tracemalloc): no more metrics!

2013-10-30 Thread Victor Stinner
2013/10/31 Victor Stinner : > Log calls to the memory allocator > - > > A different approach is to log calls to ``malloc()``, ``realloc()`` and > ``free()`` functions. Calls can be logged into a file or send to another > computer through the net

Re: [Python-Dev] PEP 454 (tracemalloc) disable ==> clear?

2013-10-31 Thread Victor Stinner
2013/10/29 Victor Stinner : > 2013/10/29 Kristján Valur Jónsson : >> I was thinking something similar. It would be useful to be able to "pause" >> and "resume" >> if one is doing any analysis work in the live environment. This would >&

Re: [Python-Dev] PEP 454 (tracemalloc) disable ==> clear?

2013-10-31 Thread Victor Stinner
2013/10/31 Victor Stinner : > If I give access to this flag, it would be possible to disable > temporarily tracing in the current thread, but tracing would still be > enabled in other threads. Would it fit your requirement? It's probably not what you are looking for :-) As I wr

[Python-Dev] PEP 454: tracemalloc (n-th version)

2013-11-03 Thread Victor Stinner
"n-th version": Sorry, I don't remember the version number of the PEP :-) http://www.python.org/dev/peps/pep-0454/ Lastest changes: * rename disable/enable/is_enabled() to stop/start/is_tracing() * Snapshot.apply_filters() now returns a new Snapshot instance * a traceback now always contains

Re: [Python-Dev] [Infrastructure] bugs.python.org not reachable in IPv6?

2013-11-04 Thread Victor Stinner
, but then falls back to IPv4. Firefox tries first IPv4 and so doesn't have the issue. Victor 2013/10/12 Antoine Pitrou : > > Opened issue at http://psf.upfronthosting.co.za/roundup/meta/issue528 > > Regards > > Antoine. > > > > Le samedi 12 octobre 2013 à 14:

Re: [Python-Dev] [Infrastructure] bugs.python.org not reachable in IPv6?

2013-11-04 Thread Victor Stinner
2013/11/4 M.-A. Lemburg : > Some things to try on the box: > > * ping6 2001:888:2000:d::a2 (that's python.org) $ ping6 -c 4 2001:888:2000:d::a2 PING 2001:888:2000:d::a2(2001:888:2000:d::a2) 56 data bytes 64 bytes from 2001:888:2000:d::a2: icmp_seq=1 ttl=56 time=53.0 ms 64 bytes from 2001:888:2000:

Re: [Python-Dev] PEP 454: tracemalloc (n-th version)

2013-11-05 Thread Victor Stinner
2013/11/3 Victor Stinner : > "n-th version": Sorry, I don't remember the version number of the PEP :-) > >http://www.python.org/dev/peps/pep-0454/ Charles-François doesn't like the magic Statistic.key attribute which may be a string, a tuple of 2 strings, or a tu

Re: [Python-Dev] Issue 19332: Guard against changing dict during iteration

2013-11-06 Thread Victor Stinner
2013/11/6 R. David Murray : > On Wed, 06 Nov 2013 23:34:22 +1100, Steven D'Aprano > wrote: >> On Tue, Nov 05, 2013 at 08:38:09PM -0800, Ethan Furman wrote: >> >> > http://bugs.python.org/issue19332 >> >> Duplicate of this: http://bugs.python.org/issue6017 >> >> The conclusion on that also was tha

[Python-Dev] Avoid formatting an error message on attribute error

2013-11-06 Thread Victor Stinner
Hi, I'm trying to avoid unnecessary temporary Unicode strings when possible (see issue #19512). While working on this, I saw that Python likes preparing an user friendly message to explain why getting an attribute failed. The problem is that in most cases, the caller doesn't care of the message: t

Re: [Python-Dev] Avoid formatting an error message on attribute error

2013-11-07 Thread Victor Stinner
2013/11/7 Steven D'Aprano : > My initial instinct here was to say that sounded like premature > optimization, but to my surprise the overhead of generating the error > message is actually significant -- at least from pure Python 3.3 code. I ran a quick and dirty benchmark by replacing the error me

Re: [Python-Dev] [Python-checkins] cpython: Fix _Py_normalize_encoding(): ensure that buffer is big enough to store "utf-8"

2013-11-07 Thread Victor Stinner
2013/11/7 Benjamin Peterson : > 2013/11/7 victor.stinner : >> http://hg.python.org/cpython/rev/99afa4c74436 >> changeset: 86995:99afa4c74436 >> user: Victor Stinner >> date:Thu Nov 07 13:33:36 2013 +0100 >> summary: >> Fix _Py_normaliz

Re: [Python-Dev] [Python-checkins] cpython: Fix _Py_normalize_encoding(): ensure that buffer is big enough to store "utf-8"

2013-11-07 Thread Victor Stinner
2013/11/7 Eric V. Smith : > Then how about at least a comment about how 6 is derived? > > if (lower_len < 6) /* 6 == strlen("utf-8") + 1 */ > return 0; Ok, I added the comment in changeset 9c929b9e0a2a. Victor ___ Python-Dev mail

Re: [Python-Dev] [Python-checkins] cpython: Issue #19512: Add PyRun_InteractiveOneObject() function

2013-11-07 Thread Victor Stinner
Hi, [PyRun_InteractiveOneObject()] 2013/11/8 Nick Coghlan : > New C APIs should either be documented or have an underscore prefix. I created the issue #19518 to add documentation (but also to add even more functions :-)). > Also, if they're part of the stable ABI, they need a version guard. As

Re: [Python-Dev] [Python-checkins] cpython: Issue #19512: Add a new _PyDict_DelItemId() function, similar to

2013-11-07 Thread Victor Stinner
2013/11/8 Nick Coghlan : >> http://hg.python.org/cpython/rev/69071054b42f >> changeset: 86968:69071054b42f >> user:Victor Stinner >> date:Wed Nov 06 18:58:22 2013 +0100 >> summary: >> Issue #19512: Add a new _PyDict_DelItemId() function

Re: [Python-Dev] [Python-checkins] cpython: Issue #19512: Add PyRun_InteractiveOneObject() function

2013-11-07 Thread Victor Stinner
2013/11/8 Nick Coghlan : >> [PyRun_InteractiveOneObject()] >> (...) >> > Also, if they're part of the stable ABI, they need a version guard. >> >> As most PyRun_xxx() functions, the function is declared in a "#ifndef >> Py_LIMITED_API" block. It means that it is not part of the stable ABI, >> is th

Re: [Python-Dev] [Python-checkins] cpython: Issue #19512: Add PyRun_InteractiveOneObject() function

2013-11-07 Thread Victor Stinner
2013/11/8 Victor Stinner : > Another question: it's not documented if a function is part or not > part of the stable ABI. So as an user of the API, it is hard to check > if a function is part of the stable ABI or not. A solution for that it maybe to split the documentation of th

Re: [Python-Dev] [Python-checkins] cpython: Issue #19512: Add a new _PyDict_DelItemId() function, similar to

2013-11-08 Thread Victor Stinner
2013/11/8 Nick Coghlan : >> In Python 3.3, _PyDict_GetItemIdWithError(), _PyDict_GetItemId() and >> _PyDict_SetItemId() are part of the stable ABI if I read correctly >> dictobject.h. _PyObject_GetAttrId() is also part of the stable ABI. >> Was it a mistake, or did I misunderstand how stable functi

Re: [Python-Dev] PEP 451 (ModuleSpec) is accepted

2013-11-08 Thread Victor Stinner
Oh congrats Eric for your PEP. I like it. Victor Le vendredi 8 novembre 2013, Eric Snow a écrit : > I'm pleased to announce that Brett Cannon and Nick Coghlan (the > co-BDFL-delegates) have accepted PEP 451 for inclusion in Python 3.4. > Both of them have contributed substantially to the discuss

Re: [Python-Dev] [RELEASE] Python 2.7.6

2013-11-10 Thread Victor Stinner
2013/11/10 Benjamin Peterson : > All the changes in Python 2.7.6 are described in full detail in the Misc/NEWS > file of the source tarball. You can also view online at > > http://hg.python.org/cpython/raw-file/99d03261c1ba/Misc/NEWS - Issue #18747: Re-seed OpenSSL's pseudo-random number gener

Re: [Python-Dev] PEP 454 (tracemalloc) close to pronouncement

2013-11-11 Thread Victor Stinner
I'm happy with the latest PEP because it is minimal but core features are still present: - get the traceback where an object was allocated, - get traces of memory blocks, - compute statistics on memory usage per line, file or traceback, - compute differences between two snapshots. We now have an

Re: [Python-Dev] PEP 454 (tracemalloc) close to pronouncement

2013-11-11 Thread Victor Stinner
2013/11/11 Charles-François Natali : > After several exchanges with Victor, PEP 454 has reached a status > which I consider ready for pronuncement [1]: so if you have any last > minute comment, now is the time! Because the PEP has a long history, 49 mercurial revisions between september and novemb

[Python-Dev] The pysandbox project is broken

2013-11-12 Thread Victor Stinner
Hi, After having work during 3 years on a pysandbox project to sandbox untrusted code, I now reached a point where I am convinced that pysandbox is broken by design. Different developers tried to convinced me before that pysandbox design is unsafe, but I had to experience it myself to be convinece

Re: [Python-Dev] [Python-checkins] cpython: Provide a more readable representation of socket on repr().

2013-11-12 Thread Victor Stinner
Hi Giampaolo, You forgot to update tests after your change in repr(socket). Tests are failing on buildbots, just one example: == FAIL: test_repr (test.test_socket.GeneralModuleTests) --

Re: [Python-Dev] The pysandbox project is broken

2013-11-12 Thread Victor Stinner
2013/11/13 Josiah Carlson : > Python-dev is for the development of the Python core language, the CPython > runtime, and libraries. Your sandbox, despite using and requiring deep > knowledge of the runtime, is not developing those things. If you had a > series of requests for the language or runtime

Re: [Python-Dev] The pysandbox project is broken

2013-11-12 Thread Victor Stinner
2013/11/13 Terry Reedy : > There are several websites running submitted Python code (and in some cases, > many other languages). > ProjectEuler > CodeAcademy (I think they use someone else's code box) > CheckIO.org - python only > other coding challenge sites > I suspect they use sandboxed processe

Re: [Python-Dev] The pysandbox project is broken

2013-11-13 Thread Victor Stinner
2013/11/13 Glenn Linderman : > If it is an implementation issue, then perhaps a different implementation > would help. Or perhaps a "safe compiler". There is PyPy with its sandbox. > If it is a language design issue, then a different implementation wouldn't > help, it would require a new language

Re: [Python-Dev] unicode Exception messages in py2.7

2013-11-14 Thread Victor Stinner
2013/11/14 Chris Barker : > (note this is about 2.7 -- sorry, but a lot of us still use that! I > can only assume that in 3.* this is a non-issue) > > I just discovered an issue that's been around a long time: > > If you create an Exception with a unicode object for the message, (...) In Python 2,

[Python-Dev] Add transform() and untranform() methods

2013-11-14 Thread Victor Stinner
Hi, I saw that Nick Coghlan documented codecs.encode() and codecs.decode(), and changed the exception raised when codecs like rot_13 are used on bytes.decode() and str.encode(). I don't like the functions codecs.encode() and codecs.decode() because the type of the result depends on the encoding (

Re: [Python-Dev] Add transform() and untranform() methods

2013-11-14 Thread Victor Stinner
is required to explain why we took this decision and list rejected alternatives. http://bugs.python.org/issue7475 Victor 2013/11/14 Victor Stinner : > Hi, > > I saw that Nick Coghlan documented codecs.encode() and > codecs.decode(), and changed the exception raised when codec

Re: [Python-Dev] Add transform() and untranform() methods

2013-11-15 Thread Victor Stinner
2013/11/15 Nick Coghlan : > The reason I'm now putting some effort into better documenting the > status quo for codec handling in Python 3 and filing off some of the > rough edges (rather than proposing adding any new APIs to Python 3.x) > is because the users I care about in this matter are web de

Re: [Python-Dev] The pysandbox project is broken

2013-11-15 Thread Victor Stinner
2013/11/15 Trent Nelson : > This sounds a lot like the work I initially did with PyParallel to > try and intercept/prevent parallel threads mutating main-thread > objects. > > I ended up arriving at a much better solution by just relying on > memory protection; main thread pages

Re: [Python-Dev] Add transform() and untranform() methods

2013-11-15 Thread Victor Stinner
2013/11/16 Nick Coghlan : > To address Serhiy's security concerns with the compression codecs (which are > technically independent of the question of restoring the aliases), I also > plan to document how to systematically blacklist particular codecs in an > application by setting attributes on the

Re: [Python-Dev] Add transform() and untranform() methods

2013-11-16 Thread Victor Stinner
Why not using str type for str and str subtypes, and bytes type for bytes and bytes-like object (bytearray, memoryview)? I don't think that we need an ABC here. Victor Le 16 nov. 2013 10:44, "Nick Coghlan" a écrit : > On 16 Nov 2013 10:47, "Victor Stinner" wr

<    2   3   4   5   6   7   8   9   10   11   >