Re: [Python-Dev] Small lament...
Oh, man, it has been a while. The last one I remember is PEP 404 (if you can find it :) ), dated 2011 and it wasn't an April Fool's... On Sat, Apr 1, 2023 at 11:23 AM Skip Montanaro wrote: > Just wanted to throw this out there... I lament the loss of waking up on > April 1st to see a creative April Fool's Day joke on one or both of these > lists, often from our FLUFL... Maybe such frivolity still happens, just not in > the Python ecosystem? I know you can still import "this" or > "antigravity", but those are now old (both introduced before 2010). When > was the last time a clever easter egg was introduced or an April Fool's Day > joke played? > > ¯\_(ツ)_/¯ > > Skip > > ___ > Python-Dev mailing list -- python-...@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-...@python.org/message/Q62W2Q6R6XMX57WK2CUGEENHMT3C3REF/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- https://mail.python.org/mailman/listinfo/python-list
[issue41515] typing.get_type_hints generates KeyError
New submission from Eric Fahlgren : Windows 10 Pro 64 Python 3.8.3 64 wxPython 4.1.0 It appears that there are synthetic classes in the mro, which don't appear in the type's namespace, raising KeyError when encountered. From reading the function's doc and source, it looks like it should handle this internally and return a valid dict (possibly empty), and not raise KeyError. >>> import typing, wx >>> typing.get_type_hints(wx.Window)' Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python38\lib\typing.py", line 1223, in get_type_hints base_globals = sys.modules[base.__module__].__dict__ >>> wx.Window.mro() [, , , , , , , ] KeyError: 'sip' -- components: Library (Lib) messages: 375111 nosy: eric.fahlgren priority: normal severity: normal status: open title: typing.get_type_hints generates KeyError versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue41515> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39629] inspect.signature fails on math.hypot
New submission from Eric Fahlgren : Python 3.8's new math.hypot function also appears to suffer from the same issue as math.log: >>> import math, inspect >>> inspect.signature(math.hypot) Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Python38\lib\inspect.py", line 3093, in signature return Signature.from_callable(obj, follow_wrapped=follow_wrapped) File "C:\Program Files\Python38\lib\inspect.py", line 2842, in from_callable return _signature_from_callable(obj, sigcls=cls, File "C:\Program Files\Python38\lib\inspect.py", line 2296, in _signature_from_callable return _signature_from_builtin(sigcls, obj, File "C:\Program Files\Python38\lib\inspect.py", line 2107, in _signature_from_builtin raise ValueError("no signature found for builtin {!r}".format(func)) ValueError: no signature found for builtin Possibly related to issue29299? -- components: Library (Lib) messages: 361966 nosy: eric.fahlgren priority: normal severity: normal status: open title: inspect.signature fails on math.hypot type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue39629> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [Scons-dev] SCons 3.1.2 Released
On Mon, Dec 16, 2019 at 7:02 PM Bill Deegan wrote: > - EXPERIMENTAL NEW FEATURE: Enable caching MSVC configuration > If SCONS_CACHE_MSVC_CONFIG shell environment variable is set, > SCons will cache the results of past calls to vcvarsall.bat to > a file; integrates with existing memoizing of such vars. > On vs2019 saves 5+ seconds per SCons invocation, which really > helps test suite runs. > Thanks a bunch for this one! Our bare, no-target 'scons' invocation is down to about 0.8 seconds now, and we can do a single DLL build in ~2.5 s, which makes things very snappy indeed. -- https://mail.python.org/mailman/listinfo/python-list
[issue35785] argparse crashes in gettext when processing missing arguments
Eric Fahlgren added the comment: Thanks, I installed 3.7.2 on one of our non-production machines and it appears that gettext has been fixed, so I'm closing this. > python -V Python 3.7.2 > python bpo35785.py --foo usage: bpo35785.py [-h] [--foo FOO] bpo35785.py: error: argument --foo: expected one argument -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35785> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35785] argparse crashes in gettext when processing missing arguments
Eric Fahlgren added the comment: After a bit more digging, it's a side effect of having the locale set with 'Plural-Forms'. I've attached the resulting .mo file, but since it's a binary, I'm not sure it will work cross-platform, so here's how to recreate it. > cat en_US/LC_MESSAGES/foo.po msgid "" msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n" > python /Python37/Tools/i18n/msgfmt.py en_US/LC_MESSAGES/foo.po > ll en_US/LC_MESSAGES/ -rwx--+ 1 efahlgren Domain Users 89 2019-01-19 14:36 foo.mo* -rw-r--r--+ 1 efahlgren Domain Users 69 2019-01-19 14:34 foo.po Then you can reproduce with some setup in your script: import os import gettext import argparse os.putenv('LANG', 'en_US') # Just to make sure. gettext.bindtextdomain('foo', '.') gettext.textdomain('foo') p = argparse.ArgumentParser() p.add_argument('--foo', nargs=None) p.parse_args() -- Added file: https://bugs.python.org/file48068/foo.mo ___ Python tracker <https://bugs.python.org/issue35785> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35785] argparse crashes in gettext when processing missing arguments
New submission from Eric Fahlgren : When argparse is configured with an option that takes arguments, then the script is invoked with the switch but no arguments, a nonsensical exception is raised during gettext processing. In the 3.7.1 source, the error is at line 2077 of argparse.py, where 'action.nargs' is not an integer as expected by 'ngettext', but one of None, '*' or '?': default = ngettext('expected %s argument', 'expected %s arguments', action.nargs) % action.nargs msg = nargs_errors.get(action.nargs, default) Fix should be pretty trivial, swap the two lines and if 'get' produces None, only then compute the default. File "C:\Program Files\Python37\lib\argparse.py", line 1749, in parse_args args, argv = self.parse_known_args(args, namespace) File "C:\Program Files\Python37\lib\argparse.py", line 1781, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "C:\Program Files\Python37\lib\argparse.py", line 1987, in _parse_known_args start_index = consume_optional(start_index) File "C:\Program Files\Python37\lib\argparse.py", line 1917, in consume_optional arg_count = match_argument(action, selected_patterns) File "C:\Program Files\Python37\lib\argparse.py", line 2079, in _match_argument action.nargs) % action.nargs File "C:\Program Files\Python37\lib\gettext.py", line 631, in ngettext return dngettext(_current_domain, msgid1, msgid2, n) File "C:\Program Files\Python37\lib\gettext.py", line 610, in dngettext return t.ngettext(msgid1, msgid2, n) File "C:\Program Files\Python37\lib\gettext.py", line 462, in ngettext tmsg = self._catalog[(msgid1, self.plural(n))] File "", line 4, in func File "C:\Program Files\Python37\lib\gettext.py", line 168, in _as_int (n.__class__.__name__,)) from None TypeError: Plural value must be an integer, got NoneType -- components: Library (Lib) messages: 334065 nosy: eric.fahlgren priority: normal severity: normal status: open title: argparse crashes in gettext when processing missing arguments versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue35785> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35785] argparse crashes in gettext when processing missing arguments
Change by Eric Fahlgren : -- type: -> crash ___ Python tracker <https://bugs.python.org/issue35785> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34252] Bunch of path leaks on Python 3.7 on Release
Eric Fahlgren added the comment: I believe that the CL command line switch is /FC, not /FP: https://msdn.microsoft.com/en-us/library/027c4t2s.aspx -- nosy: +eric.fahlgren ___ Python tracker <https://bugs.python.org/issue34252> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33656] IDLE: Turn on DPI awareness on Windows
Eric Fahlgren added the comment: So maybe add the dpiAware and dpiAwareness settings to the manifest for just Windows' pythonw.exe and leave the python.exe console interpreter alone? I'm going to guess that the pythonw.exe manifest already has some settings related to its unique status that align with this. -- ___ Python tracker <https://bugs.python.org/issue33656> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33656] IDLE: Turn on DPI awareness on Windows
Eric Fahlgren added the comment: https://msdn.microsoft.com/en-us/library/windows/desktop/mt748620(v=vs.85).aspx gives the syntax for adding dpiAwareness to the Windows manifest. -- nosy: +eric.fahlgren ___ Python tracker <https://bugs.python.org/issue33656> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26698] Tk DPI awareness
Eric Fahlgren added the comment: I used the default Application setting. -- ___ Python tracker <https://bugs.python.org/issue26698> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26698] Tk DPI awareness
Eric Fahlgren added the comment: Still blurry with 3.6.5 on Win 10 with a 2560x1600 monitor at 125% scaling (I compared it to 2.7.15, they looked identical). If I go to the Windows properties for pythonw.exe and turn on "Override high DPI scaling behavior" it's nice and sharp. -- nosy: +eric.fahlgren ___ Python tracker <https://bugs.python.org/issue26698> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [wxPython-dev] wxPython 4.0.0 final
Excellent work, Robin (and other committers)! Thanks for all your continued efforts to keep wxPython alive and growing. On Wed, Jan 31, 2018 at 5:37 PM, Robin Dunnwrote: > > Announcing wxPython 4.0.0 > = > > PyPI: https://pypi.python.org/pypi/wxPython/4.0.0 > Extras: https://extras.wxPython.org/wxPython4/extras/ > Pip:``pip install wxPython==4.0.0`` > > Changes in this release include the following: > > * Fixes in wx.aui to properly transfer ownership of the menubar, and > also some tweaks in the AUI_MDI sample in the demo. (#540) > > * Added a wx.BUILD_TYPE value to distinguish between development, > snapshot, and release builds. The value is also appended to > wx.PlatformInfo. (Thanks Mesalu!) > > * Fix crash when trying to fetch multiple items from a composite data > object in wx.DropTarget.OnData. (#550) Also fixed the > CustomDragAndDrop sample to not fail on Python 2.7. > > * Add ability for wxArray wrappers to return a copy of the item in the > ``__getitem__`` method. This solves problems where an array that is > the return value of some method call is indexed immediately and a > reference to the array is not held, which could result in garbage > values for the indexed item. Currently this is turned on for just > GridCellCoordsArray, but others can be switched in the future if > needed. (#297) > > * Add missing ``wx.GetLocale`` function. (#572) > > * Add methods to wx.TextCtrl for output "file-like" > compatibility. (#578) > > * Fix object ownership issue for menus added to toolbar items. (#580) > > * Updated SIP to version 4.19.5. One of the new features of this > version is that integer overflows are no longer silently truncated > and ignored. In other words, if a wrapped API has a parameter that > is a C int type, and you pass a value that is larger than what will > fit in that type of integer then an OverflowError exception will be > raised. > > * Fixed wx.richtext.RichTextBuffer.GetExtWildcard to return a tuple of > 2 values, as was done in Classic. (#594) > > * Various fixes in UltimateListCtrl, HyperTreeList and > CheckListCtrlMixin. (#592, #349, #612) > > * Fixes in TextEditMixin to ensure that the new value is passed in the > event. (#605) > > * Fix comparing DataViewItem and TreeListItem objects with > None. (#595) > > * Fix event type name in wx/lib/sheet.py (#613) > > * The wx.MessageDialog methods which take ButtonLabel parameters are > now able to accept either strings or stock IDs. (#607, #276) > > * Fix wx.EvtHandler.Unbind to work correctly when specifying the > handler and it is a bound method. (#624) > > * Fix OGL's ShapeCanvas to draw properly when the window is scrolled, > and to also adjust the mouse coordinates, etc. (#635) > > * Set a default background color for the generic buttons. (#651) > > * Fixed HtmlWindow's OnFoo virtual methods so calls to them are > propagated to the Python class. (#642) > > * Fixed wx.CallLater to explicitly hold a reference instead of > depending on an uncollectable cycle to keep the instance > around. Like before the cycle is broken and the saved reference is > deleted after the timer expires and the callable has been > called. (#457) > > * Although it's more or less just an implementation detail, add > wrappers for wx.aui.AuiTabCtrl so references to it will get the > correct type. (#664) > > * List-like wrapper classes generated for accessing wxLists and > wxArrays now support reverse indexing. (#669) For example:: > > child = panel.GetChildren()[-1] > > > * Ported some of the classes in Classic's gizmos module from C++ to > Python, including LEDNumberCtrl, DynamicSashWindow, and > TreeListCtrl. The classes are now located in the wx.lib.gizmos > package, with a compatibility module at the old wx.gizmos > location. Please note that this TreeListCtrl class is a very > different implementation than wx.dataview.TreeListCtrl, although > there is some overlap in purpose. In addition, the new TreeListCtrl > class is not actually a port from the old gizmos.TreeListCtrl but > rather just a thin layer around AGW's HyperTreeList. This means that > if you are using a non- default style flag you'll need to pass it to > the agwStyle parameter instead of the style parameter. > > * Fix crash when deleting all wx.dataview.TreeListCtrl items with > wxGTK3. (#679, #704) > > * Fix displaying '&' in the label of wx.RadioBox on GTK. (#39) > > * Fix problems of the wrong C++ method being called in > wx.ProgressDialog on MS Windows. (#701) > > * Fixed how the scrollbar events are captured in DynamicSashWindow in > order to fix regression in the sample. (#687) > > * Allow extra CLI args to be passed to build.py by setting > WXPYTHON_BUILD_ARGS in the environment. > > * Added context manager methods to wx.DC that explicitly destroys the > C++ part of the DC upon exit. Using DCs as context managers is not >
[issue1495754] os.listdir(): inconsistent behavior with trailing spaces
Eric Fahlgren added the comment: Would it be appropriate to make a comment about this Windows bug in both os.stat and os.path.exists documentation? I just stumbled upon it independently (both Win7 and 10, both Py 2.7 and 3.6) with nearly the same incantation that Kenneth reported over 10 years ago (exists check success, followed by scandir failure). [My workaround was to append os.sep to the directory spec: os.path.exists(newdir+os.sep) -> False ] Clearly this behavior is not going away, so it should at least be mentioned somewhere more prominently than on a decade old BPO item... -- nosy: +eric.fahlgren ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1495754> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29282] Fused multiply-add: proposal to add math.fma()
Changes by Eric Fahlgren <ericfahlg...@gmail.com>: -- nosy: +eric.fahlgren ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29282> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23407] os.walk always follows Windows junctions
Eric Fahlgren added the comment: > # Junctions are not recognized as links. > self.assertFalse(os.path.islink(self.junction)) If the above comment is intended as a statement of fact, then it's inconsistent with the implementation of Py_DeleteFileW ( https://hg.python.org/cpython/file/v3.6.0/Modules/posixmodule.c#l4178 ). -- nosy: +eric.fahlgren ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23407> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Thanks, Serhiy. I sort of figured that it would get fixed with the wordcode rework, and was going to verify that it was when 3.6 settled down. On Sun, Jun 5, 2016 at 8:30 AM, Serhiy Storchaka <rep...@bugs.python.org> wrote: > > Serhiy Storchaka added the comment: > > This bug was fixed in issue26881 with similar patch. Sorry, I didn't know > about this issue. Your patches look good. In any case thank you for your > effort. > > -- > nosy: +serhiy.storchaka > resolution: -> out of date > stage: -> resolved > status: open -> closed > superseder: -> modulefinder should reuse the dis module > > ___ > Python tracker <rep...@bugs.python.org> > <http://bugs.python.org/issue26448> > ___ > -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27129] Wordcode, part 2
Changes by Eric Fahlgren <ericfahlg...@gmail.com>: -- nosy: +eric.fahlgren ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27129> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22893] Idle: __future__ does not work in startup code.
Changes by Eric Fahlgren <ericfahlg...@gmail.com>: -- nosy: +eric.fahlgren ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22893> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Barun, take a look at the latest version of the testfindlabels.py, see what you think. If it works for you, maybe move the test function into Lib/test/test_dis.py as part of the standard dis module tests. Still need to look at the code that's being tested and find out what cases could cause problems and then augment the test to make sure it covers those. -- Added file: http://bugs.python.org/file42065/dis_with_code_scanner.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Oops, wrong/bad patch, delete line 310 "arg = None" in _get_instruction_bytes... -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Two things: 1) Verified this has always been a problem and still is in the development branch, so I added 2.7 and 3.6 to the versions list. 2) Couldn't tolerate the duplicate code handling the extended args operator, so in the interests of DRY, I moved the code scanner to a generator function (see attached dis_with_code_scanner.diff). The patch is definitely not required to fix this bug, but it does isolate the original problem area to just one piece of code. Could we get a get a quick review from a core dev saying either "go with Barun's less invasive preliminarypatch.diff" or "go with Eric's greater-churn dis_with_code_scanner.diff patch?" (We still need to flesh out the testing a bit, so don't call us, we'll call you. :) ) -- versions: +Python 2.7, Python 3.6 Added file: http://bugs.python.org/file42047/dis_with_code_scanner.diff ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: I just remembered that code can have more than one (up to three?) EXTENDED_ARG operators before the real opcode, so I added that generalization to build code around the args list... -- Added file: http://bugs.python.org/file42046/testfindlabels.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Oh, don't worry about time between responses, we all have lives (well, some of us anyhow :) ). After looking at Lib/test/test_dis.py, I think it's just an oversight that there is no specific findlabels test (it's tested implicitly by ``dis.dis`` after all), and it would be good thing for you to add one. The obvious place seems like a new method at the bottom of the ``DisTests`` class, but we'll have to rely on (probably) Yury to make that call. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Lookin' good so far. How about we try it on all the opcodes that have arguments? See attached example for which I can see two obvious improvements: 1) It could be improved by taking apart that "args" list and using it to synthesize "sample_code" rather than having to hand duplicate the values in two places, albeit with different byte order. 2) Likewise, my hard-coded "offsets" table is pretty awful. :) Also, is there already a test for the dis module in which you could just add this as a case? -- Added file: http://bugs.python.org/file42039/testfindlabels.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: The findlabels function takes a bytecode array of type bytes, usually the actual code from a function. My original test case uses the full Python compiler from source code to a CodeType object to create the bytecodes (plus all that other stuff that makes up a function), then extracts just the interesting part and passes that into findlabels. The good part is that you can pretend you're the compiler by just putting the correct bytes into a array and feed it into the various dis functions. The EXTENDED_ARG operator plays with the operand of the succeeding instruction, everything else either doesn't have an argument or has two bytes. Here's a real test case, I don't know how you write unit tests for the stdlib, but you can compare the output of the findlabels call with a known value, and that should get you pretty close. from opcode import * code = bytes( chr(opmap["JUMP_FORWARD"]) + chr(0) + chr(0) + chr(EXTENDED_ARG) + chr(1) + chr(0) + chr(opmap["JUMP_FORWARD"]) + chr(0) + chr(0) + chr(opmap["RETURN_VALUE"]), encoding="latin-1" ) import dis dis.dis(code) print(dis.findlabels(code)) if dis.findlabels(code) == [0x+3, 0x0001+9]: print("Test passed") Take a look in the stdlib opcode.py and find the various "JUMP" operators, those are the guys we care about for this. Try out a bunch of cases by augmenting the above definition of "code" and you'll soon get a feel for what's going on. As real, executable bytecode the above is of course non-sensical, but for a test, it's great because you can predict exactly what should be produced. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Well, now that I'm thinking about it, you could synthesize a bytecode stream trivially and have a much better test. This is completely off the top of my head, so take it is guaranteed to (probably) not work as written, but it should get you started: from opcodes import * import dis bytecode = ( chr(EXTENDED_ARG) + chr(1) + chr(0) + chr(JUMP_IF_TRUE_OR_POP) + chr(0) + chr(0) ) print(dis.findlabels(bytecode)) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: Our paths crossed, I don't know exactly how you'd add a test case for this, maybe construct the monster function in a string, eval the string, the use the synthesized function in dis.findlabels? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
Eric Fahlgren added the comment: My test case: def long(): z = a = b = c = d = e = f = g = h = 1 while x: x = x if x and x or not x else x above line repeated 2999 more times import dis print(dis.findlabels(long.__code__.co_code)[:10]) Buggy output: [35510, 35509, 62, 69, 78, 81, 93, 100, 109, 112] Correct output: [101046, 101045, 62, 69, 78, 81, 93, 100, 109, 112] -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26448] dis.findlabels ignores EXTENDED_ARG
New submission from Eric Fahlgren: When trying out dis.dis on some synthetically long functions, I noted that spurious branch targets were being generated in the output. First one is at address 8: 157 0 LOAD_CONST 1 (1) 3 DUP_TOP 4 STORE_FAST 0 (z) 7 DUP_TOP >>8 STORE_FAST 1 (a) 11 DUP_TOP I dug into findlabels and notices that it pays no attention to EXTENDED_ARG. The fix is pretty simple, basically copy pasta from dis._get_instructions_bytes, at line 369, in the 3.5.1 release code add all the "extended_arg" bits: extended_arg = 0 while i < n: op = code[i] i = i+1 if op >= HAVE_ARGUMENT: arg = code[i] + code[i+1]*256 + extended_arg extended_arg = 0 i = i+2 if op == EXTENDED_ARG: extended_arg = arg*65536 label = -1 -- components: Library (Lib) messages: 260913 nosy: eric.fahlgren priority: normal severity: normal status: open title: dis.findlabels ignores EXTENDED_ARG type: behavior versions: Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26448> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26110] Speedup method calls 1.2x
Changes by Eric Fahlgren <ericfahlg...@gmail.com>: -- nosy: +eric.fahlgren ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26110> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26252] Add an example to importlib docs on setting up an importer
Changes by Eric Fahlgren <ericfahlg...@gmail.com>: -- nosy: +eric.fahlgren ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26252> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com