[issue10674] Unused dictmaker symbol in 2.* grammar

2010-12-10 Thread Ori Avtalion

New submission from Ori Avtalion :

Using trunk r87157

The Grammar/Grammar file defines a "dictmaker" symbol that is no longer 
referenced in any other symbol. It should be removed.

--
components: Interpreter Core
messages: 123738
nosy: salty-horse
priority: normal
severity: normal
status: open
title: Unused dictmaker symbol in 2.* grammar
versions: Python 2.7

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



[issue1974] email.MIMEText.MIMEText.as_string incorrectly folding long subject header

2008-06-25 Thread Ori Avtalion

Ori Avtalion <[EMAIL PROTECTED]> added the comment:

I think there's been a little misinterpretation of the standard in the
comments above.

It's important to note that RFC 2822 basically defines folding as
"adding a CRLF before an existing whitespace in the original message". 

See http://tools.ietf.org/html/rfc2822#section-2.2.3

It does *not* allow prepending folded lines with extra characters that
were not in the original message such as '\t' or ' '.

This is exactly what _encode_chunks does in header.py:
joiner = NL + self._continuation_ws

(Note that the email package docs and Header docstring use the word
'prepend' which is reflects the error in the code).

With a correct implementation, why would I want to choice of which type
of character to line-break on when folding?
The whole notion of controlling the value of continuation_ws seems wrong.

However, changing the default continuation_ws to ' ', as the patch
suggests, will output syntactically correct headers in the majority of
cases (due to other bugs that remove trailing whitespace and merge
consecutive whitespace into one character).


All in all, I agree with the change of the default continuation_ws due
to its lucky side-effects, but as Barry hinted, the algorithm needs some
serious work to really output valid headers.

Some examples of the good and bad behaviors:

>>> from email.Header import Header
>>> l = ['<[EMAIL PROTECTED]>' % i for i in range(8)]

>>> # this turns out fine
>>> Header(' '.join(l), continuation_ws=' ').encode()
'<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>\n <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>'

# This does not fold even though it should
>>> Header('\t'.join(l), continuation_ws=' ').encode()
'<[EMAIL PROTECTED]>\t<[EMAIL PROTECTED]>\t<[EMAIL PROTECTED]>\t<[EMAIL 
PROTECTED]>\t<[EMAIL PROTECTED]>\t<[EMAIL PROTECTED]>\t<[EMAIL 
PROTECTED]>\t<[EMAIL PROTECTED]>'

# And here the 4-char whitespace is shrinked into one
>>> Header(''.join(l), continuation_ws=' ').encode()
'<[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL 
PROTECTED]> <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>\n <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>'

--
nosy: +salty-horse

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1974>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Ori Avtalion

Ori Avtalion  added the comment:

OK.

The attached patch removes the empty string check before decoding.

I'm not sure where tests should go, since I can only find them in Lib/test/ and 
this is not a library change.

--
keywords: +patch
Added file: http://bugs.python.org/file16254/decode.patch

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-18 Thread Ori Avtalion

Ori Avtalion  added the comment:

Ignoring the custom utf-8/latin-8 conversion functions, the actual checking if 
a codec exists is done in Python/codecs.c's PyCodec_Decode.

Is that where I should move the aforementioned optimization to?
Is it safe to assume that the decoded object is always a string/bytestring?

--

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



[issue7961] Py3k: decoding empty bytestring with invalid encoding throws no error

2010-02-20 Thread Ori Avtalion

Ori Avtalion  added the comment:

> In which specific case did you find the problem you mentioned ?

I didn't. I only pointed out the inconsistency.
I'm happy with rejecting this bug, if it's not seen as a problem.

--

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



[issue1571] Better description of 'L' repr removal in "What's New"

2007-12-08 Thread Ori Avtalion

New submission from Ori Avtalion:

The "common stumbling blocks" section reads:

* Code that unconditionally strips the trailing ``L`` from the
``repr()`` of a long integer will chop off the last digit instead.


This explains a problem and a fix without any reason (one has to guess
it from context).
It should first mention that the 'L' is no longer displayed.

--
components: Documentation
messages: 58293
nosy: salty-horse
severity: minor
status: open
title: Better description of 'L' repr removal in "What's New"
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1571>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1712] Small errors in new-style classes doc

2007-12-30 Thread Ori Avtalion

New submission from Ori Avtalion:

These refer to the "New-style and classic classes" section in
Doc/reference/datamodel.rst.

1) The URL should be <http://www.python.org/doc/newstyle/> instead of
<http://www.python.org/doc/newstyle.html>.

2) The last line: "new-style classic old-style"; seems out of place.
Maybe it was once used for indexing, but is pointless now.

--
components: Documentation
messages: 59048
nosy: salty-horse
severity: minor
status: open
title: Small errors in new-style classes doc
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1712>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2120] broken links in advocacy HOWTO

2008-02-14 Thread Ori Avtalion

New submission from Ori Avtalion:

The file python/trunk/Doc/howto/advocacy.rst has two broken links:

"http://www.catb.org/ esr/jargon/html/C/compact.html"
should be
"http://www.catb.org/~esr/jargon/html/C/compact.html";

"http://homepages.cwi.nl/ steven/abc/" (line-wrapped in the source)
should be
"http://homepages.cwi.nl/~steven/abc/";

--
components: Documentation
messages: 62419
nosy: georg.brandl, salty-horse
severity: minor
status: open
title: broken links in advocacy HOWTO
versions: Python 2.6

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2120>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2120] broken links in advocacy HOWTO

2008-02-15 Thread Ori Avtalion

Ori Avtalion added the comment:

Removing the spaces is wrong. They should be replaced with '~'.

I also found two other punctuation problems:
* A period that should be a colon.
* A comma that should be a dash/semicolon/something else. I'm not really
sure what's the best replacement.

See the attached advocacy.patch

Added file: http://bugs.python.org/file9435/advocacy.patch

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2120>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4563] Wrong formatting of contributor list in About page

2008-12-06 Thread Ori Avtalion

New submission from Ori Avtalion <[EMAIL PROTECTED]>:

The bulleted list of credits in the about page is turning people's
initials into numbering.

For example:
   * A. Amoroso
   * L. Peter Deutsch
appear as 
   * 1. Amoroso
   * 12. Peter Deutsch

<http://docs.python.org/about.html>

--
assignee: georg.brandl
components: Documentation
messages: 77128
nosy: georg.brandl, salty-horse
severity: normal
status: open
title: Wrong formatting of contributor list in About page
versions: Python 2.6, Python 3.0

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32496] lib2to3 fails to parse a ** of a conditional expression

2019-01-14 Thread Ori Avtalion


Ori Avtalion  added the comment:

This can be circumvented by adding parenthesis:

  dummy(**(kwargs if kwargs else dict()))

--
nosy: +salty-horse

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



[issue35743] Broken "Exception ignored in:" message on OSError's

2019-01-15 Thread Ori Avtalion


New submission from Ori Avtalion :

When an OSError exception is raised in __del__, both Python 2 and 3 print the 
"Exception ignored" message, but Python 3 also prints a traceback.

This is similar to issue 22836, with dealt with errors in __repr__ while inside 
__del__.

Test script:

import os

class Obj(object):
def __init__(self):
self.f = open('/dev/null')
os.close(self.f.fileno())

def __del__(self):
self.f.close()

f = Obj()
del f

Output with Python 3.7.2:

Exception ignored in: 
Traceback (most recent call last):
  File "/tmp/test.py", line 9, in __del__
self.f.close()
OSError: [Errno 9] Bad file descriptor

--
components: Interpreter Core
messages: 333661
nosy: salty-horse
priority: normal
severity: normal
status: open
title: Broken "Exception ignored in:" message on OSError's
versions: Python 3.6, Python 3.7

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



[issue22836] Broken "Exception ignored in:" message on exceptions in __repr__

2019-01-15 Thread Ori Avtalion


Ori Avtalion  added the comment:

I encountered a similar bug and reported it as issue 35743.

--
nosy: +salty-horse

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



[issue35743] Broken "Exception ignored in:" message on OSError's

2019-01-15 Thread Ori Avtalion


Ori Avtalion  added the comment:

Sorry, I was confused by how Python 3 prints the traceback of ignored 
exceptions, and Python 2 does not.

(This happens on on any exception and not just OSError)

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue35827] C API dictionary views type checkers are not documented

2019-01-25 Thread Ori Avtalion


New submission from Ori Avtalion :

dictobject.h defines several helpers to ease checking of dictionary view types. 
If they are meant to be part of the API, they should be documented.

PyDictKeys_Check
PyDictItems_Check
PyDictValues_Check
PyDictViewSet_Check

Should they be added to dict.rst, or a separate file?

--
assignee: docs@python
components: Documentation
messages: 334355
nosy: docs@python, salty-horse
priority: normal
severity: normal
status: open
title: C API dictionary views type checkers are not documented
type: enhancement
versions: Python 3.6

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



[issue36065] Add unified C API for accessing bytes and bytearray

2019-02-21 Thread Ori Avtalion


New submission from Ori Avtalion :

It would be useful to have a shared API for consuming bytes and bytearrays.

At present, I need to write very similar code twice. Some existing codebases 
only support bytes (perhaps forgetting bytearrays exist). Adding support for 
bytearray would be trivial if there was a shared API.

These are the functions/macros that can have "BytesOrByteArray" equivalents:
* PyBytes_Check
* PyBytes_CheckExact
* PyBytes_Size
* PyBytes_GET_SIZE
* PyBytes_AsString
* PyBytes_AS_STRING
* PyBytes_AsStringAndSize

Here are some example implementations for the macros:

#define PyBytesOrByteArray_Check(ob) (PyBytes_Check(ob) || 
PyByteArray_Check(ob))
#define PyBytesOrByteArray_AS_STRING(ob) (PyBytes_Check(ob) ? 
PyBytes_AS_STRING(ob) : PyByteArray_AS_STRING(ob))
#define PyBytesOrByteArray_GET_SIZE(ob) #define PyByteArray_GET_SIZE(self) 
(assert(PyBytesOrByteArray_Check(self)), Py_SIZE(self))

--
components: Interpreter Core
messages: 336218
nosy: salty-horse
priority: normal
severity: normal
status: open
title: Add unified C API for accessing bytes and bytearray
type: enhancement
versions: Python 2.7, Python 3.8

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



[issue36065] Add unified C API for accessing bytes and bytearray

2019-02-21 Thread Ori Avtalion


Ori Avtalion  added the comment:

My use-case is modifying existing code that supports bytes to also support 
bytearray.

https://github.com/mongodb/mongo-python-driver/blob/9902d239b4e557c2a657e8c8110f7751864cec95/bson/_cbsonmodule.c#L1112

The buffer protocol, which I didn't know of, feels slightly complicated for my 
use-case. For now I opted to adding these macros myself, only changing 3 lines.

--

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



[issue31155] Encode set, frozenset, bytearray, and iterators as json arrays

2018-04-26 Thread Ori Avtalion

Ori Avtalion  added the comment:

If sets are to be supported, then so should dictionary views.

Please also consider the range type.

--
nosy: +salty-horse

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2009-07-26 Thread Ori Avtalion

Changes by Ori Avtalion :


--
nosy: +salty-horse

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2009-07-26 Thread Ori Avtalion

Ori Avtalion  added the comment:

For those who missed it, the patch that was committed in r59967 was
quickly reverted in r59970 with the comment:

"Temporarily revert 59967 until GC can be added."

Raymond, can you please explain what was missing from the patch?

--

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



[issue20169] random module doc page has broken links

2016-02-15 Thread Ori Avtalion

Changes by Ori Avtalion :


--
nosy: +salty-horse

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