[issue31929] Raw strings create syntax error when last character is a single backslash

2017-11-02 Thread Barry
New submission from Barry : Raw strings create syntax error when last character is a backslash (\). This problem seems to exist across all versions of python (that I have access to) Sample Code: - Under Windows Python 2.7.3 Works

[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Barry Schwartz
New submission from Barry Schwartz : The Objects/listsort.txt incorrectly implies that it is not possible to compute leading zero bits in O(1) time, using only standard C. For a fixed integer size it can be done, for instance, using de Bruijn sequences. See https://www.chessprogramming.org

[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Barry Schwartz
Barry Schwartz added the comment: Yes. Actually the issue is branching, not order of complexity, because looping at most 64 times is a linear-bounded operation. The methods I point out involve no branching! And so can be rather fast. I don't suggest they be used, but that the listsor

[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Barry Schwartz
Barry Schwartz added the comment: I meant constant bounded -- ___ Python tracker <https://bugs.python.org/issue46488> ___ ___ Python-bugs-list mailing list Unsub

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Barry Scott added the comment: The attached patch builds on Mike's work. The core of the problem is that the Request object did not know what was going on. This means that it was not possible for get_authorization() to work for proxy-auth and www-auth. I change Request to know which o

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Barry Scott added the comment: Attached is the code I used to test these changes. See the README.txt file for details include the results of a test run. -- Added file: http://bugs.python.org/file20822/urllib2_tests.tar.gz ___ Python tracker <h

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Barry Scott added the comment: I left out some white space changes to match the style of the std lib code. Re posting with white space cleanup. -- Added file: http://bugs.python.org/file20824/http_proxy_https.patch ___ Python tracker <h

[issue7291] urllib2 cannot handle https with proxy requiring auth

2011-02-21 Thread Barry Scott
Changes by Barry Scott : Removed file: http://bugs.python.org/file20821/http_proxy_https.patch ___ Python tracker <http://bugs.python.org/issue7291> ___ ___ Python-bug

[issue46959] ctypes.util.find_library can delete /dev/null

2022-03-08 Thread Barry Davis
New submission from Barry Davis : This bug exists again: https://bugs.python.org/issue1521375 In ctypes/util we defend against gcc removing /dev/null by using a temp file, but similar code for ld still uses /dev/null, resulting in it removing /dev/null if it has permission, i.e. if running

[issue38238] site.py reporting user site info even if ENABLE_USER_SITE=False

2019-09-20 Thread Barry Muldrey
New submission from Barry Muldrey : site info is accessed externally via getusersitepackages() and getuserbase()... for example see "pip/_internal/locations.py" If ENABLE_USER_SITE is set to "False," or otherwise disabled, accesses to these methods should return '

[issue38238] site.py reporting user site info even if ENABLE_USER_SITE=False

2019-09-20 Thread Barry Muldrey
Change by Barry Muldrey : -- keywords: +patch pull_requests: +15888 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16303 ___ Python tracker <https://bugs.python.org/issu

[issue27823] Change bare AttributeError messages to be more informative

2021-05-04 Thread Anilyka Barry
Anilyka Barry added the comment: I'd forgotten that I did that. Looking back on it, this is indeed not a good change. Since there hasn't been any traction on in for 5 years, I think it's safe to say it's not something people want. -- resolution: -> rejec

[issue40126] Incorrect error handling in unittest.mock

2020-03-31 Thread Barry McLarnon
New submission from Barry McLarnon : The error handling in mock.decorate_callable (3.5-3.7) and mock.decoration_helper (3.8-3.9) is incorrectly implemented. If the error handler is triggered in the loop, the `patching` variable is out of scope and raises an unhandled `UnboundLocalError

[issue40126] Incorrect error handling in unittest.mock

2020-04-03 Thread Barry McLarnon
Barry McLarnon added the comment: After further investigation, it seems this was fixed in https://github.com/python/cpython/commit/436c2b0d67da68465e709a96daac7340af3a5238 However, this fix was as part of an unrelated changeset and in a different function in 3.8+, and was never rolled back

[issue40126] Incorrect error handling in unittest.mock

2020-04-03 Thread Barry McLarnon
Change by Barry McLarnon : -- components: +Library (Lib) -Tests ___ Python tracker <https://bugs.python.org/issue40126> ___ ___ Python-bugs-list mailin

[issue40126] Incorrect error handling in unittest.mock

2020-04-11 Thread Barry McLarnon
Barry McLarnon added the comment: Issue still exists in 3.7 and below, as it was part of a different function before. Current PR doesn't resolve the original issue that was raised. -- versions: +Python 3.5, Python 3.6 ___ Python tracker &

[issue36132] Python cannot access hci_channel field in sockaddr_hci

2019-07-04 Thread Barry Byford
Barry Byford added the comment: I was looking to control Bluetooth on Linux machines using the BlueZ Management API available at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/mgmt-api.txt The Bluetooth management sockets can be created by setting the hci_channel member of

[issue31171] multiprocessing.BoundedSemaphore of 32-bit python could not work while cross compiling on linux platform

2019-01-25 Thread Barry Davis
Barry Davis added the comment: I've just hit this issue using Python-2.7.9, gcc-8.1.0, glibc-2.23. The patch I made to fix the issue based on comments in this issue: --- Python-2.7.9/setup.py 2019-01-25 09:30:39.049501423 + +++ Python-2.7.9/setup.py 2019-01-25

[issue31171] multiprocessing.BoundedSemaphore of 32-bit python could not work while cross compiling on linux platform

2019-01-25 Thread Barry Davis
Barry Davis added the comment: The behaviour I saw (32-bit only) was a python process getting stuck. I got this from strace: ... futex(0xb5acc000, FUTEX_WAIT, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable) futex(0xb5acc000, FUTEX_WAIT, 0, NULL) = -1 EAGAIN (Resource temporarily

[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2017-05-26 Thread Barry Davis
Changes by Barry Davis : -- versions: +Python 3.6 ___ Python tracker <http://bugs.python.org/issue18748> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2017-05-26 Thread Barry Davis
Barry Davis added the comment: I think this is the same issue I'm getting. I'm hitting it when compiling python 3.6.2 compiled with gcc-4.8.4. This wasn't occasional, it was every time I tried. As a feeble workaround I was compiling in parallel, then in serial when it fails, a

[issue30524] iter(classmethod, sentinel) broken for Argument Clinic class methods?

2017-05-31 Thread Emanuel Barry
Changes by Emanuel Barry : -- nosy: +haypo, serhiy.storchaka stage: -> needs patch type: -> behavior ___ Python tracker <http://bugs.python.org/i

[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2017-05-31 Thread Barry Davis
Barry Davis added the comment: Looks like I was mistaken. My cross compiler was trying to load libgcc_s.so.1 from the standard location and not liking the one it found. Fixed for now by setting LD_LIBRARY_PATH to point at the dir containing the right libgcc_s.so.1 -- versions

[issue18748] libgcc_s.so.1 must be installed for pthread_cancel to work

2017-05-31 Thread Barry Davis
Barry Davis added the comment: I meant my cross compiled python, not my cross compiler. -- ___ Python tracker <http://bugs.python.org/issue18748> ___ ___ Pytho

[issue28937] str.split(): remove empty strings when sep is not None

2019-03-19 Thread Emanuel Barry
Emanuel Barry added the comment: Unfortunately not. I no longer have the time or means to work on this, sorry. I hope someone else can pick it up. -- ___ Python tracker <https://bugs.python.org/issue28

[issue28937] str.split(): remove empty strings when sep is not None

2019-03-19 Thread Emanuel Barry
Change by Emanuel Barry : -- nosy: -ebarry ___ Python tracker <https://bugs.python.org/issue28937> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32912] Raise non-silent warning for invalid escape sequences

2018-02-22 Thread Emanuel Barry
New submission from Emanuel Barry : This is a follow-up to Issue27364. Back in Python 3.6, a silent warning was added for all invalid escape sequences in str and bytes. It was suggested that it would remain a silent warning (which still impacts tests, while not visually annoying the average

[issue27364] Deprecate invalid escape sequences in str/bytes

2018-02-22 Thread Emanuel Barry
Emanuel Barry added the comment: I have created Issue32912 as a follow-up to this issue for 3.8. -- ___ Python tracker <https://bugs.python.org/issue27

[issue32912] Raise non-silent warning for invalid escape sequences

2018-02-24 Thread Emanuel Barry
Change by Emanuel Barry : -- keywords: +patch pull_requests: +5625 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue33035] Some examples in documentation section 4.7.2 are incorrect

2018-03-09 Thread Emanuel Barry
Emanuel Barry added the comment: The documentation is correct. The first argument in both of those cases is a str, which may not be what you were expecting, but the calls are still valid. -- nosy: +ebarry resolution: -> not a bug stage: -> resolved status: open -&g

[issue33284] Increase test coverage for numbers.py

2018-04-15 Thread Barry Devlin
New submission from Barry Devlin : The __bool__ method in the complex class in numbers is not tested. -- components: Tests messages: 315337 nosy: Barry Devlin priority: normal severity: normal status: open title: Increase test coverage for numbers.py versions: Python 3.8

[issue33284] Increase test coverage for numbers.py

2018-04-26 Thread Barry Devlin
Barry Devlin added the comment: Hey, I updated my pull request based in your advice. Could you review it please? Best, Barry On Sat, 21 Apr 2018, 03:20 Terry J. Reedy, wrote: > > Terry J. Reedy added the comment: > > Barry, thank you for your first submission. > > Y

[issue33401] `exec` attribute can't be set to objects in Python2 (SyntaxError)

2018-05-01 Thread Emanuel Barry
Emanuel Barry added the comment: This is because `exec` is a keyword in Python 2, whereas in Python 3 it's a function. -- nosy: +ebarry resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python t

[issue33401] `exec` attribute can't be set to objects in Python2 (SyntaxError)

2018-05-01 Thread Emanuel Barry
Emanuel Barry added the comment: Any valid variable name can be used as a an attribute; for example, "spam" is valid while "spam-eggs" is not. This isn't unique to classes, but to all assignments everywhere. If we allowed `o.exec = blah` then we should also allow `e

[issue33410] Using type in a format with padding causes TypeError

2018-05-02 Thread Emanuel Barry
Emanuel Barry added the comment: `type` has a default `__format__` implementation which doesn't accept any formatting options. This is expected behaviour. -- nosy: +ebarry resolution: -> not a bug stage: -> resolved status: ope

[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Emanuel Barry
Change by Emanuel Barry : -- Removed message: https://bugs.python.org/msg316153 ___ Python tracker <https://bugs.python.org/issue33423> ___ ___ Python-bugs-list m

[issue33423] [logging] Improve consistency of logger mechanism.

2018-05-03 Thread Emanuel Barry
Emanuel Barry added the comment: You don't have access to this feature, so I've deleted the message for you :) -- nosy: +ebarry ___ Python tracker <https://bugs.python.o

[issue31952] Weird behavior on tupple item assignment

2017-11-05 Thread Emanuel Barry
Emanuel Barry added the comment: This is a known issue, and is properly explained here: https://docs.python.org/3/faq/programming.html#why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works -- nosy: +ebarry resolution: -> not a bug stage: -> resolved status

[issue33892] doc Add a couple of "or she/her"

2018-06-17 Thread Emanuel Barry
Emanuel Barry added the comment: Nice initiative! I like the idea of moving towards more inclusive documentation; as an addition, I would recommend using they/them/their instead - it's less clumsy to read (also, singular they is perfectly valid English) and includes everyone, even thos

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-05-25 Thread Kevin Barry
New submission from Kevin Barry : I have been trying to get PyRun_InteractiveLoop to run on a pty (Linux) without replacing stdin and stdout with that pty; however, it seems like Python (2.6.6) is hard-coded to only run interactively on stdin and stdout. Compile the attached program with

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-23 Thread Kevin Barry
Kevin Barry added the comment: Here is a patch that corrects the problem (quoted below and attached.) This only corrects the problem when 'PyOS_ReadlineFunctionPointer' is set, e.g. you must 'import readline', otherwise Python will defer to stdin/stdout with 'PyOS_St

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-23 Thread Kevin Barry
Kevin Barry added the comment: I've attached a new example source file to demonstrate the fix. Compile the attached program with (*after* patching and installing Python): > gcc `python-config --cflags` working2.c -o working2 `python-config --ldflags` and run it with: > ./workin

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-24 Thread Kevin Barry
Kevin Barry added the comment: The patch from before needed a slight modification for when Python actually defaults to an interactive session on stdin. Since I rebuild this for my current distro (Slackware64 13.37,) I switched to the Python 2.6.6 source. This might not be the proper way to

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-07-24 Thread Kevin Barry
Kevin Barry added the comment: I've attached a simplified example program (working3.c) that demonstrates both the original problem and that the patch (Python-2.6.6-Run_Interactive-fix.patch) works. It eliminates the need for a pty, 'xterm', and redirection. Compile the a

[issue16051] Documentation missing pipes.quote()

2012-09-25 Thread Barry Morrison
New submission from Barry Morrison: Documentation here: http://docs.python.org/library/pipes.html makes no mention of quote() But the link to Source code: Lib/pipes.py http://hg.python.org/cpython/file/2.7/Lib/pipes.py has: 267 def quote(file): 268 """Return a shell-escaped

[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2012-10-08 Thread Kevin Barry
Kevin Barry added the comment: I still see the potential cause addressed by my patch in the 2.7, 3.3, and "default" branches, so I'm assuming that all versions from 2.6 on have this problem. I also see that I can elect to change the "Status" and "Resolution"

[issue28797] Modifying class __dict__ inside __set_name__

2016-11-24 Thread Emanuel Barry
Emanuel Barry added the comment: Ow! I can confirm the bug still happens on latest trunk. Nice finding! -- nosy: +ebarry, ned.deily, rhettinger, serhiy.storchaka priority: normal -> release blocker stage: -> needs patch ___ Python tracker

[issue28797] Modifying class __dict__ inside __set_name__

2016-11-24 Thread Emanuel Barry
Changes by Emanuel Barry : -- nosy: +Martin.Teichmann ___ Python tracker <http://bugs.python.org/issue28797> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28828] Connection reset by peer error when installing python packages

2016-11-28 Thread Emanuel Barry
Emanuel Barry added the comment: Decorater: For very large projects, the switch from Python 2 to 3 is a non-trivial task that can take up years of work, and there are many reasons why one cannot switch. On the issue, however, for all PyPi-related issues, please go to the PyPa GitHub: https

[issue10444] A mechanism is needed to override waiting for Python threads to finish

2016-12-01 Thread Emanuel Barry
Emanuel Barry added the comment: Let's just close this. -- nosy: +ebarry resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.pyth

[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-12-03 Thread Emanuel Barry
Changes by Emanuel Barry : -- nosy: +ebarry ___ Python tracker <http://bugs.python.org/issue23722> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue28866] Unexpected behavior resulting from mro() and __setattr__ in interactive mode

2016-12-04 Thread Emanuel Barry
Emanuel Barry added the comment: Additionally, trying to access an attribute before assigning it will result in an AttributeError on all subsequent accesses (even if set). I didn't manage to get a segfault, however. -- nosy: +ebarry ___ P

[issue28868] Python advertising BeOpen.com domain

2016-12-04 Thread Emanuel Barry
Emanuel Barry added the comment: Part of the copyright notice, as SilentGhost mentioned. This can't be removed. -- nosy: +ebarry resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http:

[issue28869] __module__ attribute is not set correctly for a class created by direct metaclass call

2016-12-04 Thread Emanuel Barry
Emanuel Barry added the comment: As a matter of fact, A.__module__ in this case is abc.ABCMeta.__module__. A class body creates a __module__ key, while a direct metaclass call does not. -- nosy: +ebarry ___ Python tracker <http://bugs.python.

[issue28869] __module__ attribute is not set correctly for a class created by direct metaclass call

2016-12-04 Thread Emanuel Barry
Emanuel Barry added the comment: Oh, nicely spotted! Apparently I was wrong, and it does create a key; defaulting to __name__. About the original issue, I don't think it's easily possible to fix, sadly. -- ___ Python trac

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-11 Thread Emanuel Barry
Emanuel Barry added the comment: I understand the feeling. However, in a project I maintain, we want the other way around - to be able to never have an empty list, even if the string is empty (we resorted to using re.split in the end, which has this behaviour). Consider: rest = re.split

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-11 Thread Emanuel Barry
Emanuel Barry added the comment: Changing the behaviour when sep is None is a big backwards-compatibility break, and I'm not sure we'd even want that. It's logical to allow passing None to mean the same thing as NULL (i.e. no arguments), and the behaviour in that case has bee

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-11 Thread Emanuel Barry
Emanuel Barry added the comment: That would work for my case, but it wouldn't for Barry's (unless I missed something). He wants a non-None argument to not leave empty strings, but I want a None argument to leave empty strings... I don't think there's a one-size-fits-all s

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-11 Thread Emanuel Barry
Emanuel Barry added the comment: Actually, there might be a way. We could make prune default to True if sep is None, and default to False if sep is not None. That way, we get to keep the existing behaviour for either case, while satisfying both of our use cases :) If that's a bad idea (a

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-11 Thread Emanuel Barry
Emanuel Barry added the comment: Matthew: Yes, that's exactly the way I was going about it. Thank you Raymond for your comments (and your informative answer on that SO question). I think that part of the problem is that no delimiter (or None) behaves differently than with a delimiter.

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-11 Thread Emanuel Barry
Emanuel Barry added the comment: Here's an initial patch. It works exactly as discussed earlier, doesn't break any tests, and retains full backwards compatibility. No doc changes (except for the docstrings of str.[r]split) and no tests, as this is just a preliminary patch to see

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-11 Thread Emanuel Barry
Emanuel Barry added the comment: Yes, I agree that being able to pass in a tuple would be really useful. As far as rolling out a custom function goes, I'd sooner reach for re.split than do that, so I don't really have a strong argument for either side. Feel free to play with the pat

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-12 Thread Emanuel Barry
Changes by Emanuel Barry : Removed file: http://bugs.python.org/file45853/split_prune_1.patch ___ Python tracker <http://bugs.python.org/issue28937> ___ ___ Python-bug

[issue28937] str.split(): remove empty strings when sep is not None

2016-12-12 Thread Emanuel Barry
Emanuel Barry added the comment: Barry: Sure, the docs example was just a quick write-up, you can word it however you want! Guido: Pretty much, except the other way around (when prune is False, i.e. "don't remove empty strings"). The attached patch exposes the behaviour (it

[issue28961] unittest.mock._Call ignores `name` parameter

2016-12-13 Thread Emanuel Barry
Emanuel Barry added the comment: That indeed looks like a bug. Well spotted :) That code has been there since unittest.mock was added back in March 2012. If I were to guess, I'd say that it should be `if name is None: name = ''`. Care to submit a patch? -

[issue28961] unittest.mock._Call ignores `name` parameter

2016-12-14 Thread Emanuel Barry
Changes by Emanuel Barry : -- stage: needs patch -> commit review ___ Python tracker <http://bugs.python.org/issue28961> ___ ___ Python-bugs-list mai

[issue28794] inspect.isasyncgen and inspect.isasyncgenfunction aren't documented

2016-12-15 Thread Emanuel Barry
Emanuel Barry added the comment: LGTM. Thanks for the patch! -- nosy: +ebarry stage: -> commit review ___ Python tracker <http://bugs.python.org/issu

[issue27135] nested list produced with multiplication is linked to the same list

2016-05-27 Thread Emanuel Barry
Emanuel Barry added the comment: The reason why Python behaves like that in this case is a side-effect of the way the data model is implemented. Lists are a mutable data type, which means that referencing the same list - which is what you are doing - as opposed to creating a new one each time

[issue27137] functools.partial: Inconsistency between Python and C implementations

2016-05-27 Thread Emanuel Barry
New submission from Emanuel Barry: functools.partial is a class in C, but the Python implementation is a function. This doesn't matter for most use cases where you only want the end result of the call to partial. A simple line in the REPL tells me enough (or so I thought) that I wou

[issue27135] nested list produced with multiplication is linked to the same list

2016-05-27 Thread Emanuel Barry
Emanuel Barry added the comment: You do raise a valid point, sequence repetition (*) on lists of mutable objects serves very little purpose. However, as I stated, it is a side-effect of the data model and changing it would be yet another special case, which aren't special enough to brea

[issue27137] functools.partial: Inconsistency between Python and C implementations

2016-05-27 Thread Emanuel Barry
Emanuel Barry added the comment: Attached patch turns the Python implementation of functools.partial into a class. The implementation is as close to the C version as possible, except __repr__ where I went for a different, more Pythonic approach (output is identical). I haven't yet

[issue27137] functools.partial: Inconsistency between Python and C implementations

2016-05-28 Thread Emanuel Barry
Emanuel Barry added the comment: Serhiy, it seems as though _functools is always required for functools to work - heck, tests start to fail all over the place if it isn't available, because functools.reduce doesn't exist. Subclassing _functools.partial is already tested for, so

[issue27137] functools.partial: Inconsistency between Python and C implementations

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: Functionally, both versions are equivalent, but one is a class and the other is not. From PEP 399: "Technical details of the VM providing the accelerated code are allowed to differ as necessary, e.g., a class being a `type` when implemented in C."

[issue27129] Wordcode, part 2

2016-05-29 Thread Emanuel Barry
Changes by Emanuel Barry : -- Removed message: http://bugs.python.org/msg266608 ___ Python tracker <http://bugs.python.org/issue27129> ___ ___ Python-bugs-list m

[issue27129] Wordcode, part 2

2016-05-29 Thread Emanuel Barry
Changes by Emanuel Barry : -- Removed message: http://bugs.python.org/msg266607 ___ Python tracker <http://bugs.python.org/issue27129> ___ ___ Python-bugs-list m

[issue27155] '-' sign typo in example

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: A negative return code generally means an error occurred. Negating retcode here is equivalent to abs(retcode), which shows you want a positive integer to appear in the message - it's not an error. Could replace '-retcode' with 'abs(retcod

[issue27157] Unhelpful error message when one calls a subclass of type

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: Works for me: >>> class X(type): pass ... >>> X(X) -- nosy: +ebarry resolution: -> works for me stage: -> resolved status: open -> closed ___ Python tracker <htt

[issue27158] `isinstance` function does not handle types that are their own type

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: Works for me: >>> class meta(type): pass ... >>> class X(type, metaclass=meta): pass ... >>> X.__class__ = X >>> type(X) is X True >>> isinstance(X, X) True -- nosy: +ebarry resolution: -> works f

[issue27158] `isinstance` function does not handle types that are their own type

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: This seems as though you might be using an older version of the interpreter (I tested in 3.4.3, 3.5.1 and 3.6.0a1+). Where did you get your interpreter? The official releases are on https://www.python.org/downloads/ - if you got it somewhere else, that might

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: In Objects/typeobject.c#L2290, the code checks that the (meta?)class is exactly `type` and that there's one argument, then returns `Py_TYPE(x)`. Subclasses of `type` allowing a single argument is a side-effect of not overriding __new__, not a docum

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: Yes, that would be preferable. The error message is at Objects/typeobject.c#l2301, but keep in mind that this message is shown for both faulty calls to type() as well as any of its subclasses that don't override __new__, and I'm lukewarm on add

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Emanuel Barry
Emanuel Barry added the comment: +1. I prefer that change, as using subclasses of `type` as if they were type itself never made sense to me. This shouldn't break existing code, but if it does, it was either a concealed bug or a very bad idea to begin with, and should be fixed eithe

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Emanuel Barry
Changes by Emanuel Barry : -- stage: needs patch -> patch review ___ Python tracker <http://bugs.python.org/issue27157> ___ ___ Python-bugs-list mailing list Un

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: Yes, `metatype == &PyType_Type` makes sure that only `type` itself is valid for the one-argument part, whereas subclasses can also do so right now. I clarified that in a comment in the new patch, so that someone doesn't accidentally revert this,

[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Emanuel Barry
Changes by Emanuel Barry : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue27160> ___ ___

[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: In other words, you cannot use keys containing a colon in str.format - you'll need to replace the colons by something else (for example an underscore, that works fine). -- nosy: +ebarry ___ Python tracker

[issue27137] Python implementation of `functools.partial` is not a class

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: New patch after Serhiy's comments. I kept the __dict__ in pickling to properly pickle attributes that aren't defined by 'partial' itself; but if 'func', 'args' or 'keywords' are present and don't match

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: Fair enough. Should this get a note in What's new? Possibly in the "Changes in Python API" section. -- stage: patch review -> commit review versions: +Python 3.6 -Python 2.7, Python 3.4 ___ Pyt

[issue27160] str.format: Silent truncation of kwargs when passing keywords containing colons

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: The behaviour is correct, it's your assumptions that aren't :) The code for str.format only checks for what's before the colon (here, "HGNC") and checks if that's part of the dict provided. It isn't, so it raises a KeyError

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: Let me just make sure I got you right - you're fine with `type` and only `type` being able to use the one-argument form in 3.6, but prefer 3.5 and 2.7 to be even more permissive than they currently are? Regardless, I don't think this should go int

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Emanuel Barry
Changes by Emanuel Barry : -- Removed message: http://bugs.python.org/msg266711 ___ Python tracker <http://bugs.python.org/issue27157> ___ ___ Python-bugs-list m

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: New patch with tests and documentation. I didn't really know where to put the tests; test_types seemed reasonable to me (other option was test_metaclass). -- stage: test needed -> commit review ___ Python

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Emanuel Barry
Changes by Emanuel Barry : Added file: http://bugs.python.org/file43060/type_one_argument_3.patch ___ Python tracker <http://bugs.python.org/issue27157> ___ ___ Python-bug

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-30 Thread Emanuel Barry
Emanuel Barry added the comment: New patch with Berker's comments. I'm really not used to Sphinx markup so thanks for that! > Is there any person who really thinks that their own patch is *not* ready for > commit review? :) Partial patches aren't that uncommon in

[issue27166] interesting info

2016-05-31 Thread Emanuel Barry
Changes by Emanuel Barry : -- Removed message: http://bugs.python.org/msg266751 ___ Python tracker <http://bugs.python.org/issue27166> ___ ___ Python-bugs-list m

[issue27166] interesting info

2016-05-31 Thread Emanuel Barry
Changes by Emanuel Barry : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue27166> ___ ___

[issue21271] reset_mock needs parameters to also reset return_value and side_effect

2016-06-02 Thread Emanuel Barry
Changes by Emanuel Barry : -- resolution: -> fixed stage: patch review -> resolved ___ Python tracker <http://bugs.python.org/issue21271> ___ ___ Pyth

[issue27192] Keyboard Shortcuts Consistently Cause Crashes

2016-06-02 Thread Emanuel Barry
Changes by Emanuel Barry : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Tkinter Unresponsive With Special Keys ___ Python tracker <http://bugs.python

[issue27193] Tkinter Unresponsive With Special Keys

2016-06-02 Thread Emanuel Barry
Changes by Emanuel Barry : -- components: +Extension Modules stage: -> needs patch type: -> behavior ___ Python tracker <http://bugs.python.org/i

[issue25548] Show the address in the repr for class objects

2016-06-03 Thread Emanuel Barry
Emanuel Barry added the comment: I'd probably change all instances of ".*" in the regex matches to be "0x.+" instead. For the docstrings that have "..." in them, I would probably make those " at ..." as well (although you get decide if it hinders r

  1   2   3   4   5   6   7   8   9   10   >