[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

[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

[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

[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

[issue27217] IDLE 3.5.1 not using Tk 8.6

2016-06-04 Thread Emanuel Barry
Changes by Emanuel Barry : -- components: +IDLE, Macintosh nosy: +kbk, ned.deily, roger.serwy, ronaldoussoren, terry.reedy stage: -> test needed type: resource usage -> behavior versions: +Python 3.5 ___ Python tracker <http://bugs.p

[issue27220] Add a pure Python version of 'collections.defaultdict'

2016-06-04 Thread Emanuel Barry
New submission from Emanuel Barry: Attached patch adds a pure Python version of `collections.defaultdict`. This is yet another step in providing better support for alternate implementations, which may or may not have `_collections`. I also went ahead and fixed __all__ so that `from

[issue26809] Add __all__ list to the string module

2016-06-04 Thread Emanuel Barry
Changes by Emanuel Barry : -- title: `string` exposes ChainMap from `collections` -> Add __all__ list to the string module ___ Python tracker <http://bugs.python.org/issu

[issue21130] equivalent functools.partial instances should compare equal

2016-06-04 Thread Emanuel Barry
Emanuel Barry added the comment: Git diffs work, but this one doesn't apply cleanly. I manually fixed it and re-generated the patch. Rietveld should pick it up now. Otherwise, what Jelle said. I'm not sure if the macro has the best name though - I'd probably name it `PyPartial_

[issue21130] equivalent functools.partial instances should compare equal

2016-06-04 Thread Emanuel Barry
Emanuel Barry added the comment: New patch with Jelle's suggestions. I completely removed the macros since we need to (potentially) call Python code with PyObject_IsInstance, and need to check for return code. I also reverted some of the unrelated changes. -- Added file:

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

2016-06-04 Thread Emanuel Barry
Emanuel Barry added the comment: New patch, now almost all the tests that are used for the C version are also used for the Python version (the only exception is the one checking that trying to change/delete attributes would raise an error). Some tests needed a bit of tweaking to work with the

[issue21130] equivalent functools.partial instances should compare equal

2016-06-05 Thread Emanuel Barry
Emanuel Barry added the comment: Shakur - Feel free to take over and work on it. Serhiy - I don't think that partial(func) == func should be, in the same sense that (0, 1, 2), [0, 1, 2] and range(3) aren't equal even though they fundamentally represent the

[issue27242] Clarify the use cases of NotImplemented in the docs

2016-06-06 Thread Emanuel Barry
New submission from Emanuel Barry: The NotImplemented docs aren't explicit enough when it comes to where it can/should be used. Patch attached. -- assignee: docs@python components: Documentation files: NotImplemented_wording_1.patch keywords: patch messages: 267543 nosy: docs@p

[issue27242] Make the docs for NotImplemented & NotImplementedError unambigous

2016-06-06 Thread Emanuel Barry
Emanuel Barry added the comment: Added further notes to `NotImplemented` and `NotImplementedError` to clearly state the differences between the two. I also added some more details to `TypeError` - I'm amazed at how little was described for such a common exception! Maybe I explained a bi

[issue27246] Keyboard Shortcuts Crash Idle

2016-06-06 Thread Emanuel Barry
Emanuel Barry added the comment: Your report was already addressed in #27192, and the solution to your problem was given by Ned Deily. If you are still experiencing crashes with the official python.org version, please specify so. In the meantime, I'm closing this off as dupl

[issue27242] Make the docs for NotImplemented & NotImplementedError unambigous

2016-06-06 Thread Emanuel Barry
Emanuel Barry added the comment: New patch with small tweaks. Thanks Jelle for the comments! -- Added file: http://bugs.python.org/file43273/NotImplemented_exceptions_wording_3.patch ___ Python tracker <http://bugs.python.org/issue27

[issue27242] Make the docs for NotImplemented & NotImplementedError unambigous

2016-06-07 Thread Emanuel Barry
Emanuel Barry added the comment: More tweaks after Ethan's comments. This is starting to get way outside of the realm of NotImplemented, but it still makes for a good reference to point confused users at. -- Added file: http://bugs.python.org/file

[issue27242] Make the docs for NotImplemented & NotImplementedError unambigous

2016-06-08 Thread Emanuel Barry
Emanuel Barry added the comment: Martin: yes, I plan to install Sphinx soon enough, so that I can build the docs. As for the notes part, I indented it exactly like it was indented for other existing notes boxes in the same file. I'll change that if needed t

[issue27356] csv

2016-06-20 Thread Emanuel Barry
Emanuel Barry added the comment: (Berker beat me to it, but posting anyway since it is more detailed) Backslashes are escape characters, and "\b" is treated as "\x08". Invalid combinations (e.g. "\A", "\D"...) automatically escape the backslash, but yo

[issue27358] BUILD_MAP_UNPACK_WITH_CALL is slow

2016-06-21 Thread Emanuel Barry
Emanuel Barry added the comment: `dict` subclasses can be hashable - it's a very bad idea, but not guarded against. If you were to do this, I'd suggest going the exception way, à la StopIteration. I wonder how feasible it would be for e.g. dict.__setitem__ to check if a key alre

[issue27362] json.dumps to check for obj.__json__ before raising TypeError

2016-06-21 Thread Emanuel Barry
Emanuel Barry added the comment: I'm not too familiar with the json package, but what should __json__ return when called? -- nosy: +ebarry stage: -> test needed versions: +Python 3.6 ___ Python tracker <http://bugs.python.org

[issue27362] json.dumps to check for obj.__json__ before raising TypeError

2016-06-21 Thread Emanuel Barry
Emanuel Barry added the comment: So __json__ returns a string meant to be serializable. I'm not too keen on using a dunder name (although my word doesn't weigh anything ;) and I'd personally prefer something like as_json_string(). I think the idea in general is good, though. Mi

[issue27364] Deprecate invalid unicode escape sequences

2016-06-21 Thread Emanuel Barry
New submission from Emanuel Barry: Attached patch deprecates invalid escape sequences in unicode strings. The point of this is to prevent issues such as #27356 (and possibly other similar ones) in the future. Without the patch: >>> "hello \world" 'hello \\world'

[issue27364] Deprecate invalid unicode escape sequences

2016-06-23 Thread Emanuel Barry
Emanuel Barry added the comment: Now I have! I found nothing on Python-Dev, but apparently it's been discussed on Python-ideas before: https://mail.python.org/pipermail/python-ideas/2015-August/035031.html Guido hasn't participated in that discussion, and most of it was "

[issue27364] Deprecate invalid unicode escape sequences

2016-06-23 Thread Emanuel Barry
Emanuel Barry added the comment: Yes, it's in use in an awful lot of places (see my patch). The proper fix is to use raw strings, or, if you need actual escapes in the same string, manually escape them. However, as you'll see by looking at the patch, the vast majority of cases ar

[issue27364] Deprecate invalid unicode escape sequences

2016-06-23 Thread Emanuel Barry
Emanuel Barry added the comment: Thanks, didn't find that one. Apparently Guido's stance is "Make this a silent warning, then we can discuss about preventing it later", which happens to be what I'm doing here. --

[issue27364] Deprecate invalid unicode escape sequences

2016-06-23 Thread Emanuel Barry
Emanuel Barry added the comment: I found the cause of the failed assertion, an invalid escape sequence slipped through in a file. Patch attached (also with Serhiy's comments). It worries me a little though that pure Python code can cause a hard crash. Ok, it worries me a lot. Please

[issue27382] calendar module .isleap() probleam

2016-06-24 Thread Emanuel Barry
Emanuel Barry added the comment: You're overriding the 'calendar' variable, holding the module, by the result of your 'calender.month' call, which happens to be a str. Use a different variable name (e.g. 'result') and the error will disappear. Unrelated

[issue27364] Deprecate invalid unicode escape sequences

2016-06-26 Thread Emanuel Barry
Emanuel Barry added the comment: I originally considered making two different patches, so there you go. deprecate_invalid_escapes_only_1.patch has the deprecation plus a test, and invalid_stdlib_escapes_1.patch fixes all invalid escapes in the stdlib. My code was the cause, although no

[issue27364] Deprecate invalid unicode escape sequences

2016-06-26 Thread Emanuel Barry
Changes by Emanuel Barry : Added file: http://bugs.python.org/file43550/invalid_stdlib_escapes_1.patch ___ Python tracker <http://bugs.python.org/issue27364> ___ ___ Pytho

[issue27394] Crash with compile returning a value with an error set

2016-06-26 Thread Emanuel Barry
New submission from Emanuel Barry: My trivial patch exposed a bug in the ast/compiler, where compile() would return a value and set an exception. See http://bugs.python.org/issue27364#msg269323 for more information and steps to reproduce. I looked a bit into it, but I don't know enough

[issue27364] Deprecate invalid unicode escape sequences

2016-06-26 Thread Emanuel Barry
Emanuel Barry added the comment: Ah right, assert() is only enabled in debug mode, I forgot that. My (very uneducated) guess is that compile() got the error (which was a warning) but then decided to return a value anyway, and the next thing that tries to call anything crashes Python. I opened

[issue27394] Crash with compile returning a value with an error set

2016-06-26 Thread Emanuel Barry
Emanuel Barry added the comment: Nevermind, my mistake. -- resolution: -> not a bug stage: needs patch -> resolved status: open -> closed type: crash -> ___ Python tracker <http://bugs.python

[issue27364] Deprecate invalid unicode escape sequences

2016-06-26 Thread Emanuel Barry
Emanuel Barry added the comment: Aaand I feel pretty stupid; I didn't check the return value of PyErr_WarnFormat, so it was my mistake. Attached new patch, actually done right this time. -- Added file: http://bugs.python.org/file43552/deprecate_invalid_escapes_only_2.

[issue27364] Deprecate invalid unicode escape sequences

2016-06-26 Thread Emanuel Barry
Emanuel Barry added the comment: Indeed, we did, thanks for letting me know my mistake :) I didn't get very far into making bytes literal disallow invalid sequences, as I ran into issues with _codecs.escape_decode throwing the warning even when the literal was fine, and I think I st

[issue27364] Deprecate invalid unicode escape sequences

2016-06-27 Thread Emanuel Barry
Emanuel Barry added the comment: I think ultimately a SyntaxError should be fine. I don't know *when* it becomes appropriate to change a warning into an error; I was thinking 3.7 but, as Serhiy said, there's no rush. I think waiting five release cycles is overkill though, that means

[issue27364] Deprecate invalid unicode escape sequences

2016-06-27 Thread Emanuel Barry
Emanuel Barry added the comment: Easing transition is always a good idea. I'll contact the PyCQA people later today when I'm back home. On afterthought, it makes sense to wait more than two release cycles before making this an error. I don't really have a strong opinion wh

  1   2   3   4   >