[issue39939] PEP 616: Add str.removeprefix and str.removesuffix methods

2020-05-27 Thread Elazar Gershuni


Change by Elazar Gershuni :


--
nosy: +elazar
nosy_count: 8.0 -> 9.0
pull_requests: +19726
pull_request: https://github.com/python/cpython/pull/20473

___
Python tracker 
<https://bugs.python.org/issue39939>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18077] dis.dis throws IndexError

2013-05-27 Thread Elazar Gershuni

New submission from Elazar Gershuni:

>>> dis.dis('pass')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/dis.py", line 45, in dis
disassemble_string(x)
  File "/usr/lib/python2.7/dis.py", line 112, in disassemble_string
labels = findlabels(code)
  File "/usr/lib/python2.7/dis.py", line 166, in findlabels
oparg = ord(code[i]) + ord(code[i+1])*256
IndexError: string index out of range

it happens for any string.

--
components: Library (Lib)
messages: 190169
nosy: elazar
priority: normal
severity: normal
status: open
title: dis.dis throws IndexError
type: compile error
versions: Python 2.7

___
Python tracker 
<http://bugs.python.org/issue18077>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18077] dis.dis throws IndexError

2013-05-27 Thread Elazar Gershuni

Elazar Gershuni added the comment:

it happens that: (code, i) == ('pass', 4)

--

___
Python tracker 
<http://bugs.python.org/issue18077>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18077] dis.dis throws IndexError

2013-05-28 Thread Elazar Gershuni

Elazar Gershuni added the comment:

Is it standard procedure to raise an unrelated exception in when an invalid 
parameter is passed? I did not encounter any other library function that 
behaves like this. Especially taking the fact that this is the normal usage in 
python3. 

How do I supposed to *know* this is not a bug? I can't find similar behavior in 
other library functions. An IndexError and a traceback *inside the library* 
does not help.

--

___
Python tracker 
<http://bugs.python.org/issue18077>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18077] dis.dis raises IndexError

2013-05-28 Thread Elazar Gershuni

Changes by Elazar Gershuni :


--
title: dis.dis throws IndexError -> dis.dis raises IndexError

___
Python tracker 
<http://bugs.python.org/issue18077>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18077] dis.dis throws IndexError

2013-05-28 Thread Elazar Gershuni

Elazar Gershuni added the comment:

If you pass 'None' for `path`, then "'NoneType' object has no attribute 
'endswith'" is not as nearly as obscure.

But if you insist not to fix it, and don't mind to leave another arbitrary 
inconsistency between python2 and python3 obscured, I have nothing more to say 
- you can close it if you want.

--

___
Python tracker 
<http://bugs.python.org/issue18077>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13107] Text width in optparse.py can become negative

2013-09-01 Thread Elazar Gershuni

Elazar Gershuni added the comment:

I think in such case it is reasonable to fail silently, since the information 
will not be readable anyway.
Is a patch like the attached acceptable? (Sorry, I am new here)

results:

>>> import os, argparse; p = argparse.ArgumentParser(prog='PROG')
>>> os.environ['COLUMNS'] = '0'
>>> print(p.format_help())
usage: PROG
   
   [-h]

optional arguments:
  -h, --help  

>>>

--
keywords: +patch
nosy: +elazar
Added file: http://bugs.python.org/file31552/fixargparse.patch

___
Python tracker 
<http://bugs.python.org/issue13107>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

New submission from Elazar Gershuni:

Inner sections "leak" out from enum to the general datatypes index:
http://docs.python.org/3.4/library/datatypes.html

(sections 8.14 - 8.17)

--
assignee: docs@python
components: Documentation
messages: 196816
nosy: docs@python, elazar
priority: normal
severity: normal
status: open
title: Enum docs: sections leak out

___
Python tracker 
<http://bugs.python.org/issue18908>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Elazar Gershuni added the comment:

here's a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file31561/enumcontain.patch

___
Python tracker 
<http://bugs.python.org/issue18908>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Added file: http://bugs.python.org/file31562/enumindent.patch

___
Python tracker 
<http://bugs.python.org/issue18908>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Added file: http://bugs.python.org/file31563/enumplusminor.patch

___
Python tracker 
<http://bugs.python.org/issue18908>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Added file: http://bugs.python.org/file31564/enumplusminor.patch

___
Python tracker 
<http://bugs.python.org/issue18908>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18908] Enum docs: sections leak out

2013-09-02 Thread Elazar Gershuni

Changes by Elazar Gershuni :


Removed file: http://bugs.python.org/file31563/enumplusminor.patch

___
Python tracker 
<http://bugs.python.org/issue18908>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18980] Docs: enum - ReST format

2013-09-08 Thread Elazar Gershuni

New submission from Elazar Gershuni:

in http://docs.python.org/3.4/library/enum.html :
"..note: Nomenclature"
and 
".:meth:__format__"

visible in the html.

--
assignee: docs@python
components: Documentation
files: enum_minor.patch
keywords: patch
messages: 197312
nosy: docs@python, elazar
priority: normal
severity: normal
status: open
title: Docs: enum - ReST format
versions: Python 3.4
Added file: http://bugs.python.org/file31682/enum_minor.patch

___
Python tracker 
<http://bugs.python.org/issue18980>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13107] Text width in optparse.py can become negative

2013-09-11 Thread Elazar Gershuni

Elazar Gershuni added the comment:

ok. how about argparse_ugly.patch? below some width it simply won't do any 
wrapping.

(I hadn't touch optparse yet)

--
Added file: http://bugs.python.org/file31731/argparse_ugly.patch

___
Python tracker 
<http://bugs.python.org/issue13107>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19200] grammar in forkserver docs

2013-10-08 Thread Elazar Gershuni

New submission from Elazar Gershuni:

in http://docs.python.org/3.4/library/multiprocessing.html#start-methods
for `forkserver`:
"whenever a new process is need the parent process connects to the server and 
requests that it fork a new process."

replace "need " with "needed, ".

--
assignee: docs@python
components: Documentation
messages: 199269
nosy: docs@python, elazar
priority: normal
severity: normal
status: open
title: grammar in forkserver docs
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue19200>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19235] Add a dedicated subclass for recursion errors

2013-10-12 Thread Elazar Gershuni

New submission from Elazar Gershuni:

There's no dedicated StackOverflowErrorException, So there is no way to 
accurately distinguish a recursion overflow from a general RuntimeError. 

One cannot use the exception message, since the docs explicitly says that 
"Exception messages are not part of the Python API", and checking for

len(traceback.extract_tb(trace)) >= sys.getrecursionlimit()-1

is ugly, and (AFAIK) not guaranteed to be correct.

Use case: I've found this while trying to create a cycle detector that will 
compress the traceback of such errors.

See discussion in python-ideas:
https://mail.python.org/pipermail/python-ideas/2013-September/023190.html

An cycle-detection implementation:
http://code.activestate.com/recipes/578660-concise-output-for-maximum-recursion-depth-exceede/

--
components: Library (Lib)
messages: 199595
nosy: elazar
priority: normal
severity: normal
status: open
title: Add a dedicated subclass for recursion errors
type: enhancement
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue19235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19235] Add a dedicated subclass for recursion errors

2013-10-12 Thread Elazar Gershuni

Changes by Elazar Gershuni :


--
nosy: +georg.brandl

___
Python tracker 
<http://bugs.python.org/issue19235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19235] Add a dedicated subclass for recursion errors

2013-10-20 Thread Elazar Gershuni

Elazar Gershuni added the comment:

Looks good to me.

Is it possible to add it to 2.7? I think it won't break any PEP8-following code 
(e.g. not testing for type equality/identity)

--

___
Python tracker 
<http://bugs.python.org/issue19235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20733] Typo in itertools docs - "itertool-functions"

2014-02-22 Thread Elazar Gershuni

New submission from Elazar Gershuni:

typo - should be "itertools-functions" instead of "itertool-functions"

http://docs.python.org/3.4/library/itertools.html#itertool-functions

--
assignee: docs@python
components: Documentation
messages: 211950
nosy: docs@python, elazar
priority: normal
severity: normal
status: open
title: Typo in itertools docs - "itertool-functions"
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue20733>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20733] Typo in itertools docs - "itertool-functions"

2014-02-22 Thread Elazar Gershuni

Elazar Gershuni added the comment:

"itertools" is not English, but the name of the Python library. So it is not 
plural, and not a matter of choice of English phrasing.

In addition, as a section name, it should be "Functions" with a capital F, just 
like "Itertools Recipes" down there.
http://docs.python.org/3.4/library/itertools.html#itertools-recipes

--

___
Python tracker 
<http://bugs.python.org/issue20733>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19235] Add a dedicated subclass for recursion errors

2014-03-06 Thread Elazar Gershuni

Elazar Gershuni added the comment:

Is it going to be committed?

--

___
Python tracker 
<http://bugs.python.org/issue19235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29357] New NamedTuple syntax silently ignores method definitions

2017-01-23 Thread Elazar Gershuni

New submission from Elazar Gershuni:

The following does not work as expected:
```
from typing import NamedTuple

class A(NamedTuple):
a: int

def __repr__(self):
return 'some A'

def spam(self):
print('spam!')

>>> a = A(5)
>>> repr(a)  # should be 'some A'
'A(a=5)'
>>> a.spam()
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'A' object has no attribute 'spam'
```

--
components: Library (Lib)
messages: 286147
nosy: elazar, gvanrossum, rhettinger
priority: normal
severity: normal
status: open
title: New NamedTuple syntax silently ignores method definitions
type: behavior
versions: Python 3.6

___
Python tracker 
<http://bugs.python.org/issue29357>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17287] slice inconsistency

2013-02-24 Thread Elazar Gershuni

New submission from Elazar Gershuni:

slice behavior is not consistent for negative lower or upper arguments, which 
could be surprising:

>>> 'hello'[:-2]
'hel'
>>> 'hello'[:-1]
'hell'
>>> 'hello'[:-0]
''

this is obvious when written as literal, but not so obvious when using 
variables in expressions like 'fullname[:-len(lastname)]'. same goes for 
'lower'.

--
components: None
messages: 182874
nosy: elazar
priority: normal
severity: normal
status: open
title: slice inconsistency
type: enhancement
versions: Python 3.1

___
Python tracker 
<http://bugs.python.org/issue17287>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22975] Crosses initialization?

2014-12-01 Thread Elazar Gershuni

Elazar Gershuni added the comment:

https://hg.python.org/cpython/file/62a058c76869/Objects/unicodeobject.c#l9884

--

___
Python tracker 
<http://bugs.python.org/issue22975>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22975] Crosses initialization?

2014-12-01 Thread Elazar Gershuni

Changes by Elazar Gershuni :


--
hgrepos:  -282

___
Python tracker 
<http://bugs.python.org/issue22975>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22975] Crosses initialization?

2014-12-01 Thread Elazar Gershuni

New submission from Elazar Gershuni:

In Objects/unicodeobject.c, What happens in these lines?

case PyUnicode_4BYTE_KIND: { \
Py_UCS4 * to_ = (Py_UCS4 *)((data)) + (start); \
for (; i_ < (length); ++i_, ++to_) *to_ = (value); \
break; \
default: assert(0); \
} \ // Closing earlier case block. Should be one line up?
} \ // Closing the switch statement

(I got error here trying to compile Python in g++).

--
components: Build
hgrepos: 282
messages: 231947
nosy: elazar
priority: normal
severity: normal
status: open
title: Crosses initialization?
type: compile error
versions: Python 3.5

___
Python tracker 
<http://bugs.python.org/issue22975>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19235] Add a dedicated subclass for recursion errors

2015-05-30 Thread Elazar Gershuni

Elazar Gershuni added the comment:

Ok

--

___
Python tracker 
<http://bugs.python.org/issue19235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19235] Add a dedicated subclass for recursion errors

2015-06-18 Thread Elazar Gershuni

Elazar Gershuni added the comment:

So what holds it back now?

--

___
Python tracker 
<http://bugs.python.org/issue19235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19235] Add a dedicated subclass for recursion errors

2015-06-18 Thread Elazar Gershuni

Elazar Gershuni added the comment:

Well that's a déjà vu.

--

___
Python tracker 
<http://bugs.python.org/issue19235>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com