Re: [Python-Dev] cpython: inspect: Add __slots__ to BoundArguments.
On Fri, 15 May 2015 09:28:07 +0300 Serhiy Storchaka wrote: > On 14.05.15 00:38, yury.selivanov wrote: > > https://hg.python.org/cpython/rev/ee31277386cb > > changeset: 96038:ee31277386cb > > user:Yury Selivanov > > date:Wed May 13 17:18:41 2015 -0400 > > summary: > >inspect: Add __slots__ to BoundArguments. > > Note that adding __slots__ breaks pickleability. That's a problem indeed. I think picklability should be part of the Signature and BoundArguments contracts. Regards Antoine. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Summary of Python tracker Issues
ACTIVITY SUMMARY (2015-05-08 - 2015-05-15) 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: open4840 ( +2) closed 31123 (+54) total 35963 (+56) Open issues with patches: 2237 Issues opened (39) == #21162: code in multiprocessing.pool freeze if inside some code from s http://bugs.python.org/issue21162 reopened by Ivan.K #21593: Clarify re.search documentation first match http://bugs.python.org/issue21593 reopened by Joshua.Landau #23757: tuple function gives wrong answer when called on list subclass http://bugs.python.org/issue23757 reopened by r.david.murray #24134: assertRaises can behave differently http://bugs.python.org/issue24134 reopened by serhiy.storchaka #24147: doublequote are not well recognized with Dialect class http://bugs.python.org/issue24147 opened by MiK #24148: 'cum' not a valid sort key for pstats.Stats.sort_stats http://bugs.python.org/issue24148 opened by ramiro #24151: test_pydoc fails http://bugs.python.org/issue24151 opened by hsiehr #24152: test_mailcap fails if a mailcap file contains a non-decodable http://bugs.python.org/issue24152 opened by petrosr2 #24153: threading/multiprocessing tests fail on chromebook under crout http://bugs.python.org/issue24153 opened by shiprex #24154: pathlib.Path.rename moves file to Path.cwd() when argument is http://bugs.python.org/issue24154 opened by yurit #24157: test_urandom_fd_reopened failure if OS X crash reporter defaul http://bugs.python.org/issue24157 opened by skip.montanaro #24159: Misleading TypeError when pickling bytes to a file opened as t http://bugs.python.org/issue24159 opened by jason.coombs #24160: Pdb sometimes crashes when trying to remove a breakpoint defin http://bugs.python.org/issue24160 opened by ppperry #24162: [2.7 regression] test_asynchat test failure on i586-linux-gnu http://bugs.python.org/issue24162 opened by doko #24163: shutil.copystat fails when attribute security.selinux is prese http://bugs.python.org/issue24163 opened by sstirlin #24164: Support pickling objects with __new__ with keyword arguments w http://bugs.python.org/issue24164 opened by serhiy.storchaka #24165: Free list for single-digits ints http://bugs.python.org/issue24165 opened by serhiy.storchaka #24166: ArgumentParser behavior does not match generated help http://bugs.python.org/issue24166 opened by tellendil #24168: Unittest discover fails with namespace package if the path con http://bugs.python.org/issue24168 opened by toshishige hagihara #24169: sockets convert out-of-range port numbers % 2**16 http://bugs.python.org/issue24169 opened by Kurt.Rose #24172: Errors in resource.getpagesize module documentation http://bugs.python.org/issue24172 opened by mahmoud #24173: curses HOWTO/implementation disagreement http://bugs.python.org/issue24173 opened by White_Rabbit #24174: Python crash on exit http://bugs.python.org/issue24174 opened by gnumdk #24175: Test failure in test_utime on FreeBSD http://bugs.python.org/issue24175 opened by koobs #24176: Incorrect parsing of unpacked expressions in call http://bugs.python.org/issue24176 opened by tcaswell #24177: Add https?_proxy support to http.client http://bugs.python.org/issue24177 opened by demian.brecht #24180: PEP 492: Documentation http://bugs.python.org/issue24180 opened by yselivanov #24181: test_fileio crash, 3.5, Win 7 http://bugs.python.org/issue24181 opened by terry.reedy #24182: test_tcl assertion failure, 2.7, Win 7 http://bugs.python.org/issue24182 opened by terry.reedy #24186: OpenSSL causes buffer overrun exception http://bugs.python.org/issue24186 opened by steve.dower #24190: BoundArguments facility to inject defaults http://bugs.python.org/issue24190 opened by pitrou #24192: unexpected system error with pep420 style namespace packages http://bugs.python.org/issue24192 opened by ronaldoussoren #24193: Make LOGGING_FORMAT of assertLogs configurable http://bugs.python.org/issue24193 opened by berker.peksag #24194: tokenize yield an ERRORTOKEN if an identifier uses Other_ID_St http://bugs.python.org/issue24194 opened by Joshua.Landau #24195: Add `Executor.filter` to concurrent.futures http://bugs.python.org/issue24195 opened by cool-RR #24198: please align the platform tag for windows http://bugs.python.org/issue24198 opened by doko #24199: Idle: remove idlelib.idlever.py and its use in About dialog http://bugs.python.org/issue24199 opened by terry.reedy #24200: Redundant id in informative reprs http://bugs.python.org/issue24200 opened by serhiy.storchaka #24201: _winreg PyHKEY Type Confusion http://bugs.python.org/issue24201 opened by JohnLeitch Most recent 15 issues with no replies (15) == #24200: Redundant id in informative reprs http://bugs.python.org/issue24200 #24194: tokenize yield an ERRORTOKEN if
Re: [Python-Dev] cpython: inspect: Add __slots__ to BoundArguments.
No, it does not. I implemented __getstate__/__setstate__ specifically to maintain backwards compatibility (I also tested it). Yury On 2015-05-15 2:28 AM, Serhiy Storchaka wrote: On 14.05.15 00:38, yury.selivanov wrote: https://hg.python.org/cpython/rev/ee31277386cb changeset: 96038:ee31277386cb user:Yury Selivanov date:Wed May 13 17:18:41 2015 -0400 summary: inspect: Add __slots__ to BoundArguments. Note that adding __slots__ breaks pickleability. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/yselivanov.ml%40gmail.com ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] cpython: inspect: Add __slots__ to BoundArguments.
There are pickle tests for all signature related classes (all protocols for BoundArguments, Signature and Parameter). This patch ensures that old pickled BoundArguments will be unpickled without a problem in 3.5. Yury On 2015-05-15 7:57 AM, Antoine Pitrou wrote: On Fri, 15 May 2015 09:28:07 +0300 Serhiy Storchaka wrote: On 14.05.15 00:38, yury.selivanov wrote: https://hg.python.org/cpython/rev/ee31277386cb changeset: 96038:ee31277386cb user:Yury Selivanov date:Wed May 13 17:18:41 2015 -0400 summary: inspect: Add __slots__ to BoundArguments. Note that adding __slots__ breaks pickleability. That's a problem indeed. I think picklability should be part of the Signature and BoundArguments contracts. Regards Antoine. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/yselivanov.ml%40gmail.com ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Minimal async event loop and async utilities (Was: PEP 492: async/await in Python; version 4)
On Mon, May 11, 2015 at 6:05 PM, Guido van Rossum wrote: > OTOH you may look at micropython's uasyncio -- IIRC it doesn't have Futures > and it definitely has I/O waiting. Here's a sketch of an *extremely* minimal main loop that can do I/O without Futures, and might be suitable as a PEP example. (Certainly, it would be hard to write a *simpler* example than this, since it doesn't even use any *classes* or require any specially named methods, works with present-day generators, and is (I think) both 2.x/3.x compatible.) coroutines = [] # round-robin of currently "running" coroutines def schedule(coroutine, val=None, err=None): coroutines.insert(0, (coroutine, val, err)) def runLoop(): while coroutines: (coroutine, val, err) = coroutines.pop() try: if err is not None: suspend = coroutine.throw(err) else suspend = coroutine.send(val) except StopIteration: # coroutine is finished, so don't reschedule it continue except Exception: # framework-specific detail (i.e., log it, send # to an error handling coroutine, or just stop the program # Here, we just ignore it and stop the coroutine continue else: if hasattr(suspend, '__call__') and suspend(coroutine): continue else: # put it back on the round-robin list schedule(coroutine) To use it, `schedule()` one or more coroutines, then call `runLoop()`, which will run as long as there are things to do. Each coroutine scheduled must yield *thunks*: callable objects that take a coroutine as a parameter, and return True if the coroutine should be suspended, or False if it should continue to run. If the thunk returns true, that means the thunk has taken responsibility for arranging to `schedule()` the coroutine with a value or error when it's time to send it the result of the suspension. You might be asking, "wait, but where's the I/O?" Why, in a coroutine, of course... readers = {} writers = {} timers = [] def readable(fileno): """yield readable(fileno) resumes when fileno is readable""" def suspend(coroutine): readers[fileno] = coroutine return True return suspend def writable(fileno): """yield writable(fileno) resumes when fileno is writable""" def suspend(coroutine): writers[fileno] = coroutine return True return suspend def sleepFor(seconds): """yield sleepFor(seconds) resumes after that much time""" return suspendUntil(time.time() + seconds) def suspendUntil(timestamp): """yield suspendUntil(timestamp) resumes when that time is reached""" def suspend(coroutine) heappush(timers, (timestamp, coroutine) return suspend def doIO(): while coroutines or readers or writers or timers: # Resume scheduled tasks while timers and timers[0][0] <= time.time(): ts, coroutine = heappop(timers) schedule(coroutine) if readers or writers: if coroutines: # Other tasks are running; use minimal timeout timeout = 0.001 else if timers: timeout = max(timers[0][0] - time.time(), 0.001) else: timeout = 0 # take as long as necessary r, w, e = select(readers, writers, [], timeout) for rr in r: schedule(readers.pop(rr)) for ww in w: schedule(writers.pop(ww)) yield # allow other coroutines to run schedule(doIO()) # run the I/O loop as a coroutine (This is painfully incomplete for a real framework, but it's a rough sketch of how one of peak.events' first drafts worked, circa early 2004.) Basically, you just need a coroutine whose job is to resume coroutines whose scheduled time has arrived, or whose I/O is ready. And of course, some data structures to keep track of such things, and an API to update the data structures and suspend the coroutines. The I/O loop exits once there are no more running tasks and nothing waiting on I/O... which will also exit the runLoop. (A bit like a miniature version of NodeJS for Python.) And, while you need to preferably have only *one* such I/O coroutine (to prevent busy-waiting), the I/O coroutine is completely replaceable. All that's required to implement one is that the core runloop expose the count of active coroutines. (Notice that, apart from checking the length of `coroutines`, the I/O loop shown above uses only the public `schedule()` API and the exposed thunk-suspension protocol to do its thing.) Also, note that you *can* indeed have mult
[Python-Dev] Scandir module's C code updated to Python 3.5 code
Hi folks, With os.scandir() now in the Python 3.5 stdlib, I just thought I'd let folks know that I've released the scandir module version 1.0. So this is now basically a copy-n-paste of the C code that went into CPython 3.5's posixmodule.c with the necessary changes to make it work or Python 2.x (2.6+). You can use the following import to pick os.scandir/os.walk if on Python 3.5+ or the scandir module version otherwise: try: from os import scandir, walk except ImportError: from scandir import scandir, walk I've tested it and it all looks good and performs well, but please let me know if you have any issues! * PyPI: https://pypi.python.org/pypi/scandir * Github project: https://github.com/benhoyt/scandir Would love to hear any success/speedup stories, too! -Ben ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Python-versus-CPython question for __mul__ dispatch
On Thu, May 14, 2015 at 11:53 PM, Nathaniel Smith wrote: > On Thu, May 14, 2015 at 9:29 PM, Guido van Rossum wrote: >> I expect you can make something that behaves like list by defining __mul__ >> and __rmul__ and returning NotImplemented. > > Hmm, it's fairly tricky, and part of the trick is that you can never > return NotImplemented (because you have to pretty much take over and > entirely replace the normal dispatch rules inside __mul__ and > __rmul__), but see attached for something I think should work. > > So I guess this is just how Python's list, tuple, etc. work, and PyPy > and friends need to match... For the record, it looks like PyPy does already have a hack to implement this -- they do it by having a hidden flag on the built-in sequence types which the implementations of '*' and '+' check for, and if it's found it triggers a different rule for dispatching to the __op__ methods: https://bitbucket.org/pypy/pypy/src/a1a494787f4112e42f50c6583e0fea18db3fb4fa/pypy/objspace/descroperation.py?at=default#cl-692 -- Nathaniel J. Smith -- http://vorpus.org ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] No tags in semi-official github mirror of cpython repository.
Hi. I foud "semi official github mirror" of cpython. https://github.com/python/cpython I want to use it as upstream of our project (Translating docs in Japanese). But it doesn't have tags. Is the repository stable enough for forking project like us? Or should we use mercurial? Could you mirror tags too? Thanks -- INADA Naoki ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com