[issue46081] Document the msg argument for assertRaises

2021-12-15 Thread Ram Rachum


New submission from Ram Rachum :

The `msg` argument to the `assertRaises` function isn't documented. The 
documentation should say what this argument does.

--
assignee: docs@python
components: Documentation
messages: 408587
nosy: cool-RR, docs@python
priority: normal
severity: normal
status: open
title: Document the msg argument for assertRaises
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

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



[issue46081] Document the msg argument for assertRaises

2021-12-15 Thread Ram Rachum


Ram Rachum  added the comment:

Thanks, but people looking at a specific function might not guess that the 
documentation for one of its arguments is hiding somewhere on the long page. 
This is especially relevant with a confusing argument like `msg`, since it's 
tempting to think that this would be the message of the expected exception.

--

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



[issue46081] Document the msg argument for assertRaises

2021-12-15 Thread Ram Rachum


Ram Rachum  added the comment:

I'd include that same message you quoted, minus the list of functions, on each 
and every one of the functions that have this argument.

--

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



[issue46081] Document the msg argument for assertRaises

2021-12-15 Thread Ram Rachum


Ram Rachum  added the comment:

I disagree but I guess I'm in the minority here, so I'll close this issue.

--
stage:  -> resolved
status: open -> closed

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



[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor

2022-01-23 Thread Ram Rachum


Ram Rachum  added the comment:

Oh that sucks. Logan and Antoine worked on this feature for so long. Thanks for 
reporting Greg.

--

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



[issue13163] `port` and `host` are confused in `_get_socket

2011-10-12 Thread Ram Rachum

New submission from Ram Rachum :

Look here:

http://hg.python.org/cpython/file/3313ce92cef7/Lib/smtplib.py#l279

`port` and `host` are confused.

I saw this is fixed on 3.2; possibly it should be fixed in the next 2.7 micro 
release too.

--
components: Library (Lib)
messages: 145442
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `port` and `host` are confused in `_get_socket
versions: Python 2.7

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



[issue13163] `port` and `host` are confused in `_get_socket

2011-10-13 Thread Ram Rachum

Ram Rachum  added the comment:

The reason this bug bothered me is because I was debugging a Django app, and in 
the stacktrace's local variables I suddenly saw that `host` was `25`, which 
seemed like a bug to me and wasted me 5 minutes. So it's not a critical bug but 
it wasted my time.

--

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



[issue13457] Display module name as string in `ImportError`

2011-11-22 Thread Ram Rachum

New submission from Ram Rachum :

Recently I was confronted with a mysterious error:

ImportError: No module named datetime

Firther investigation revealed that the cause was a pickling problem that ran 
`__import__('datetime\r')`.

If `ImportError` would have shown the module name as a string, there would be 
no ambiguity:

ImportError: No module named 'datetime\r'

--
components: Interpreter Core
messages: 148140
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Display module name as string in `ImportError`
versions: Python 3.3

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



[issue13457] Display module name as string in `ImportError`

2011-11-22 Thread Ram Rachum

Changes by Ram Rachum :


--
type:  -> behavior

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



[issue13457] Display module name as string in `ImportError`

2011-11-22 Thread Ram Rachum

Changes by Ram Rachum :


--
status: open -> closed

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



[issue13600] rot_13 codec not working

2011-12-14 Thread Ram Rachum

New submission from Ram Rachum :

The `rot_13` codec is supposed to work like this, no?

>>> 'qwerty'.encode('utf-8')
b'qwerty'
>>> 'qwerty'.encode('rot_13')
Traceback (most recent call last):
  File "", line 1, in 
'qwerty'.encode('rot_13')
TypeError: encoder did not return a bytes object (type=str)

>>> b'qwerty'.decode('utf-8')
'qwerty'
>>> b'qwerty'.decode('rot_13')
Traceback (most recent call last):
  File "", line 1, in 
b'qwerty'.decode('rot_13')
  File "C:\Python32\lib\encodings\rot_13.py", line 19, in decode
return (input.translate(rot13_map), len(input))
AttributeError: 'memoryview' object has no attribute 'translate'

--
components: Library (Lib)
messages: 149431
nosy: cool-RR
priority: normal
severity: normal
status: open
title: rot_13 codec not working
versions: Python 3.3

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



[issue13600] rot_13 codec not working

2011-12-14 Thread Ram Rachum

Ram Rachum  added the comment:

Then I suggest replacing this error message:

encoder did not return a bytes object (type=str)

and this one:

'memoryview' object has no attribute 'translate'

With something like:

Please use `codecs.lookup('rot-13').encode`

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
resolution: invalid -> 
status: closed -> open

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



[issue11969] Can't launch multiproccessing.Process on methods

2011-05-26 Thread Ram Rachum

Ram Rachum  added the comment:

Why is this still marked as "test needed"?

--

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



[issue11969] Can't launch multiproccessing.Process on methods

2011-05-27 Thread Ram Rachum

Ram Rachum  added the comment:

Diff attached, is it good? I'm not very experienced with diffs, I usually work 
with pull requests.

--
keywords: +patch
Added file: http://bugs.python.org/file22144/patch.diff

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



[issue11969] Can't launch multiproccessing.Process on methods

2011-05-27 Thread Ram Rachum

Changes by Ram Rachum :


Removed file: http://bugs.python.org/file22144/patch.diff

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



[issue11969] Can't launch multiproccessing.Process on methods

2011-05-27 Thread Ram Rachum

Changes by Ram Rachum :


Removed file: http://bugs.python.org/file22027/test.py

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



[issue11969] Can't launch multiproccessing.Process on methods

2011-05-27 Thread Ram Rachum

Ram Rachum  added the comment:

Thanks for the `-u` tip and the correction to the code, Petri. I removed my 
previous files since yours is the definite one. And yeah, it's a Windows issue.

--

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



[issue12449] Add accelerator "F" to button "Finish" in all MSI installers made by bdist_msi

2011-06-30 Thread Ram Rachum

New submission from Ram Rachum :

I noticed that in MSI installers downloaded from PyPI don't have an accelerator 
on the Finish button. Please add an accelerator on it. (I think that "F" is the 
accepted one.)

--
assignee: tarek
components: Distutils
messages: 139463
nosy: cool-RR, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: Add accelerator "F" to button "Finish" in all MSI installers made by 
bdist_msi
type: behavior
versions: Python 3.3, Python 3.4

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



[issue12449] Add accelerator "F" to button "Finish" in all MSI installers made by bdist_msi

2011-06-30 Thread Ram Rachum

Ram Rachum  added the comment:

I can only do wxPython, I have no idea how Python's MSI installers work. I did 
a quick search for "Finish" in the codebase but could find any obvious place to 
add the accelerator.

"As a new feature, this cannot go into distutils."

Seriously? Why?

--

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



[issue12522] Implement `os.startfile` under Linux and Mac

2011-07-09 Thread Ram Rachum

New submission from Ram Rachum :

I want to use `os.startfile` to open a folder in Explorer/Nautilus/Finder. The 
documentation says that it's only implemented on Windows:

http://docs.python.org/dev/library/os.html#os.startfile

See discussion on Python-ideas here:
https://groups.google.com/forum/?hl=en#!topic/python-ideas/LL0SavbKrEA


Is there a good reason why `os.startfile` is implemented only on Windows?

--
components: Library (Lib)
messages: 140057
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Implement `os.startfile` under Linux and Mac
versions: Python 3.3

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



[issue3177] implement os.startfile on posix and MacOSX

2011-07-09 Thread Ram Rachum

Changes by Ram Rachum :


--
nosy: +cool-RR

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



[issue12543] `issubclass(collections.deque, collections.Sequence) == False`

2011-07-12 Thread Ram Rachum

New submission from Ram Rachum :

Is there a good reason that `issubclass(collections.deque, 
collections.Sequence) == False`? What's not-sequence-y about `deque`?

--
messages: 140206
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `issubclass(collections.deque, collections.Sequence) == False`

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



[issue3177] implement os.startfile on posix and MacOSX

2011-07-13 Thread Ram Rachum

Ram Rachum  added the comment:

Eric, I have no problem with this function being placed in `shutil` instead of 
`os`, as long as it's implemented and it's in the standard library, and people 
don't have to use subprocess to run open or xdg-open themselves as I currently 
do.

So I have no problem with renaming this bug to "Add shutil.open".

--

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



[issue12583] More detailed `ImportError` messages

2011-07-18 Thread Ram Rachum

New submission from Ram Rachum :

I've been frustrated so many times by `ImportError: cannot import name foo`. 
Right now I'm debugging some problem on a PAAS server (with no SSH access), and 
the server returns a traceback of `cannot import name foo`, and I don't have 
any idea what it means. It could mean that the file isn't there. It could mean 
that there's a circular import problem. Sometimes it happens when you go over 
Windows XP's path length limit!

Please provide a useful explanation, like this:

ImportError: Cannot import `foo` because no file foo.py* or folder foo 
exists.
ImportError: Cannot import foo module because no __init__.py* file exists 
in the foo folder.
ImportError: Cannot import foo because of a circular import problem with 
bar.
ImportError: Cannot import foo because the foo module file's path is bigger 
than Windows XP's path length limit.

Etcetera for any other reason that might cause an `ImportError`.

--
components: Interpreter Core
messages: 140614
nosy: cool-RR
priority: normal
severity: normal
status: open
title: More detailed `ImportError` messages
versions: Python 3.3

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



[issue12583] More detailed `ImportError` messages

2011-07-18 Thread Ram Rachum

Ram Rachum  added the comment:

As long as those attributes are reflected in the string in human language, why 
not.

--

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



[issue12583] More detailed `ImportError` messages

2011-07-18 Thread Ram Rachum

Ram Rachum  added the comment:

What's the problem with detecting circular imports? Mind you that we only need 
a post-mortem analysis to check why the import failed; so after the import 
failed, we could check whether our import stack has a loop in it.

I'm not familiar with the ImportWarning regarding `__init__.py`. Is this 
written about anywhere?

--

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



[issue12583] More detailed ImportError messages

2011-07-19 Thread Ram Rachum

Ram Rachum  added the comment:

Brett: Why does it matter that it will be costly? It's a post-mortem activity 
anyway, usually done when something critical failed and the entire system isn't 
working.

Why would functions need to be looked at? I mean, isn't a circular import when 
you try to import a module `foo` while in a lower stack level you haven't 
finished importing `foo` yet? Does it get trickier than that?

--

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



[issue12583] More detailed ImportError messages

2011-07-19 Thread Ram Rachum

Ram Rachum  added the comment:

Brett, I checked out the two pieces of documentation you referred to, they have 
very little information about ImportWarning other than "Base class for warnings 
about probable mistakes in module imports."

--

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



[issue12583] More detailed ImportError messages

2011-07-20 Thread Ram Rachum

Ram Rachum  added the comment:

David, I don't think you've read my message carefully enough. I'm well aware 
that there are other ways in Python to import than the `import` statement. I'm 
proposing that it doesn't matter.

I asked, "isn't a circular import when you try to import a module `foo` while 
in a lower stack level you haven't finished importing `foo` yet?" If this is 
true, then you just need to have some kind of flag for each module saying "This 
module is currently being imported", which you set to `True` when you start 
importing and back to `False` when you finished importing. (It doesn't have to 
look exactly like this, it could be a context manager, or alternatively a 
centralized list of all module that are currently in the middle of an import.) 
Then when you have an `ImportError`, you check whether the module that the user 
tried to import has that flag raised, and if so notify him that it's probably a 
circular import problem.

Will that work?

--

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



[issue12583] More detailed ImportError messages

2011-07-21 Thread Ram Rachum

Ram Rachum  added the comment:

Thanks for explaining, I guess it's too complicated.

--

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



[issue12653] Provide accelerators for all buttons in Windows installers

2011-07-29 Thread Ram Rachum

New submission from Ram Rachum :

I was installing Python 3.2.1 on my laptop today, and was unable to efficiently 
use the keyboard in order to navigate the installation dialogs. Every button 
should have an accelerator, e.g. "Next" should be "&Next" so Alt-N will press 
it. (I don't know whether you use the ampersand notation or something else.)

--
messages: 141340
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Provide accelerators for all buttons in Windows installers
versions: Python 3.3, Python 3.4

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



[issue12895] In MSI/EXE installer, allow installing Python modules in free path

2011-09-04 Thread Ram Rachum

New submission from Ram Rachum :

Currently, when you use an MSI installer (and possibly also EXE) for a Python 
module, it automatically detects the location of your various system's Python 
installations. This is very convenient.

However, this can be a problem sometimes, if your Python installation doesn't 
conform to what's required by the installer. For example, if you want to 
install the module in a virtualenv:

http://serverfault.com/questions/305008/installing-compiled-python-modules-on-windows-on-a-virtual-env

The installer doesn't give you any option to manually enter a path of a Python 
installation, so you just can't install!

The installer's automatic Python-finding mechanism should degrade gracefully; 
it should offer to automatically find your Python installation, but it should 
allow you to bypass it and type it in yourself.

--
assignee: tarek
components: Distutils2
messages: 143503
nosy: alexis, cool-RR, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: In MSI/EXE installer, allow installing Python modules in free path
versions: Python 3.3

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



[issue12895] In MSI/EXE installer, allow installing Python modules in free path

2011-09-06 Thread Ram Rachum

Ram Rachum  added the comment:

Martin, what do you mean "administrative installation"?

--

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



[issue9823] OrderedDict is comparable to dict

2010-09-10 Thread Ram Rachum

New submission from Ram Rachum :

OrderedDict is currently comparable to dict.

I think this is not logical, because a dict doesn't have order, and having an 
identical order is a necessary condition for a match.

I think that comparing an OrderedDict with a dict makes as much sense as 
comparing a tuple with a set, and that's currently not allowed. (Always returns 
False)

Here's a disturbing code snippet executed in Python 3.2a1:

>>> from collections import OrderedDict
>>> d1 = OrderedDict(((1, 2), (3, 4)))
>>> d2 = OrderedDict(((3, 4), (1, 2)))
>>> d1 == d2
False
>>> d1 == {1: 2, 3: 4} == d2
True

--
components: Library (Lib)
messages: 116027
nosy: cool-RR
priority: normal
severity: normal
status: open
title: OrderedDict is comparable to dict
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue9823] OrderedDict is comparable to dict

2010-09-10 Thread Ram Rachum

Ram Rachum  added the comment:

Thanks Benjamin. Was there a discussion about this in the mailing list? If so 
can you give me a link to it?

--

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



[issue9872] `a.b.my_function is not b.my_function` when `a` and `b` are both on `sys.path`

2010-09-16 Thread Ram Rachum

New submission from Ram Rachum :

Let's say you have this structure:

a\
  __init__.py
  b\
__init__.py

In `b.__init__` a function called `my_function` is defined.

And assume that `a` and `b` are both on `sys.path`. Then this situation happens:

>>> import a.b
>>> import b
>>> a.b.my_function is b.my_function
False
>>> a.b.my_function

>>> b.my_function

>>> a.b.my_function.__module__
'a.b'
>>> b.my_function.__module__
'b'

It seems that `a.b.my_function` and `b.my_function` are different objects.

--
messages: 116536
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `a.b.my_function is not b.my_function` when `a` and `b` are both on 
`sys.path`
type: behavior
versions: Python 2.6, Python 3.1, Python 3.2

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



[issue9872] `a.b.my_function is not b.my_function` when `a` and `b` are both on `sys.path`

2010-09-17 Thread Ram Rachum

Ram Rachum  added the comment:

Benjamin,

This behavior is involved in a problem I have with Django. When using Django, 
you have apps that live inside a project:

my_project\
  __init__.py
  my_app\
__init__.py
views.py

So if you have a view function in `views.py`, it will have two separate 
identities, and that causes problems.

Do you have an idea what I can do about it?

--

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



[issue9898] cProfile.runctx doesn't allow sort argument

2010-09-19 Thread Ram Rachum

New submission from Ram Rachum :

The `cProfile.runctx` function currently doesn't allow using the `sort` 
argument. For some reason the `sort` argument is allowed in `run` but not in 
`runctx`. Attached is a patch that allows using `sort` in `runctx`.

--
components: Library (Lib)
files: cProfile.patch
keywords: patch
messages: 116880
nosy: cool-RR
priority: normal
severity: normal
status: open
title: cProfile.runctx doesn't allow sort argument
type: feature request
versions: Python 2.7, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file18932/cProfile.patch

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



[issue9898] cProfile.runctx doesn't allow sort argument

2010-09-20 Thread Ram Rachum

Ram Rachum  added the comment:

Is this going into 3.2?

--

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



[issue10011] `except` doesn't use `isinstance`

2010-10-01 Thread Ram Rachum

New submission from Ram Rachum :

Is there a reason why `execpt` compares base classes instead of using 
`isinstance`? This prevents using `__instancecheck__` to override the instance 
check.

--
components: Interpreter Core
messages: 117844
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `except` doesn't use `isinstance`
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue10011] `except` doesn't use `isinstance`

2010-10-01 Thread Ram Rachum

Ram Rachum  added the comment:

I don't understand the infinite recursion argument. If there's such an infinite 
recursion, wouldn't it be due to a bug in the user's implementation of 
__instancecheck__?

--

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



[issue10011] `except` doesn't use `isinstance`

2010-10-02 Thread Ram Rachum

Ram Rachum  added the comment:

Also, how important is the performance of exception checking *after* an 
exception was raised? I mean, wouldn't it matter only for programs that raise 
and catch hundreds of exceptions a second?

--

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



[issue8289] multiprocessing.Process.__init__ pickles all arguments

2011-02-23 Thread Ram Rachum

Changes by Ram Rachum :


--
versions: +Python 3.3 -Python 3.2

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



[issue9276] pickle should support methods

2011-02-23 Thread Ram Rachum

Ram Rachum  added the comment:

I also miss being able to pickle unbound methods on Python 3. I don't think 
there's an interest in pickling the actual code objects. In my opinion, unbound 
methods should be pickled exactly like all the other Python definitions, such 
as bound methods, top-level functions, and classes: They should be pickled by 
name.

IIUC, the challenge is how to figure out on which class an unbound method is 
defined. I'm using the term "unbound method" colloquially, I know it's 
implemented as a function. So perhaps Python needs to be changed to give 
unbound methods some attribute that will tell on which class they're defined?

--
nosy: +cool-RR

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



[issue9276] pickle should support methods

2011-02-23 Thread Ram Rachum

Changes by Ram Rachum :


--
versions: +Python 3.3 -Python 3.2

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



[issue11299] Allow deepcopying and pickling paused generators

2011-02-23 Thread Ram Rachum

New submission from Ram Rachum :

Please allow to deepcopy and to pickle paused generators, including all their 
state.

This is implemented in Pypy:

Python 2.5.2 (335e875cb0fe, Dec 28 2010, 20:31:56)
[PyPy 1.4.1] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.1.1
>>> import pickle, copy
>>> def next(thing): # For compatibility
... return thing.next()
>>> def g():
... for i in range(4):
... yield i
>>> list(g())
[0, 1, 2, 3]
>>> live_generator = g()
>>> next(live_generator)
0
>>> next(live_generator)
1

Now `live_generator` holds a generator which is in the middle of its operation. 
It went through 0 and 1, and it still has 2 and 3 to yield.

We deepcopy it: 

>>> live_generator_deepcopy = copy.deepcopy(live_generator)

The deepcopied generator assumes the same state of the original one. Let's 
exhaust it:  

>>> list(live_generator_deepcopy)
[2, 3]
>>> list(live_generator_deepcopy)
[]

Pypy also lets us pickle and unpickle the live generator:

>>> live_generator_pickled = pickle.dumps(live_generator)
>>> live_generator_unpickled = pickle.loads(live_generator_pickled)
>>> list(live_generator_unpickled)
[2, 3]
>>> list(live_generator_unpickled)
[]

And the original live generator was unchanged by all these operations:

>>> list(live_generator)
[2, 3]
>>> list(live_generator)
[]

All the above was demonstrated in Pypy. In Python 3.2, trying to pickle a live 
generator raises this exception:

>>> pickle.dumps(live_generator)
Traceback (most recent call last):
  File "", line 1, in 
_pickle.PicklingError: Can't pickle : attribute 
lookup builtins.generator failed

And trying to deepcopy one raises this exception:

>>> copy.deepcopy(live_generator)
Traceback (most recent call last):
  File "", line 1, in 
  File "c:\Python32\lib\copy.py", line 174, in deepcopy
y = _reconstruct(x, rv, 1, memo)
  File "c:\Python32\lib\copy.py", line 285, in _reconstruct
y = callable(*args)
  File "c:\Python32\lib\copyreg.py", line 88, in __newobj__
return cls.__new__(cls, *args)
TypeError: object.__new__(generator) is not safe, use 
generator.__new__()

It would be nice if Python 3.2 could pickle and deepcopy live generators.

--
components: Library (Lib)
messages: 129213
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Allow deepcopying and pickling paused generators
type: feature request
versions: Python 3.3

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



[issue11299] Allow deepcopying and pickling paused generators

2011-02-23 Thread Ram Rachum

Ram Rachum  added the comment:

P.S. I'm willing to write a test-case if it will help.

--

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



[issue11299] Allow deepcopying and pickling paused generators

2011-02-25 Thread Ram Rachum

Ram Rachum  added the comment:

Tests attached.

--
Added file: http://bugs.python.org/file20898/test_live_generator.py

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



[issue11299] Allow deepcopying and pickling paused generators

2011-02-26 Thread Ram Rachum

Ram Rachum  added the comment:

Hi Alexandre,

I read your blog post, but I don't understand-- Why does bytecode need to be 
pickled in order to pickle live generators? I understand that the local 
variables need to be pickled, (and let's assume they're all pickleable,) and 
that a pointer to the current instruction needs to be pickled, but why the 
bytecode? When you pickle a normal function or a class, no bytecode gets 
pickled, so why does it have to be pickled here?

--

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



[issue11299] Allow deepcopying and pickling paused generators

2011-02-26 Thread Ram Rachum

Ram Rachum  added the comment:

*"generator objects do not have names we can refer to"*

How about referring to the generator function that created them and to all the 
arguments?

Regarding instruction pointer, I really don't know the internals of how this 
works. Can we make some arrangement so we can specify line number (and possibly 
column number too) as a cross-interpreter instruction pointer?

--

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



[issue11356] Include module name on ImportError

2011-02-28 Thread Ram Rachum

Changes by Ram Rachum :


--
nosy: +cool-RR

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



[issue1559549] ImportError needs attributes for module and file name

2011-03-01 Thread Ram Rachum

Changes by Ram Rachum :


--
nosy: +cool-RR

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



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum  added the comment:

Okay, as an initial suggestion, how about we give every function a 
`.__parent_class__` attribute saying which class it is a method of? I feel this 
is a bit of a duct tape solution, but I don't see any other alternative.

--

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



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum  added the comment:

Raymond: I don't think this matters. We don't need a canonical 
`.__parent_class__`, we just need to know where that function is defined so we 
could find it when unpickling. In the example that you gave, `f` would have a 
`.__parent_class__` of `None`, and it would be pickleable because it would be 
found on the top-level of the module it's defined on.

--

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



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum  added the comment:

> This isn't worth introducing poorly thought out hacks.

Being able to pickle unbound methods is important. In my project I have objects 
that refer to unbound methods. Now these objects are unpickleable. I can't save 
them to disk and I can't use the multiprocessing module on them. That's a big 
problem.

--

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



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum  added the comment:

> [...]  try to whip up a patch and upload it if it ends up not too hackish.

To have a non-hackish patch we need a non-hackish idea. The `.__parent_class__` 
idea looks hackish to me, but now that I think about it, how is it more hackish 
than a function's `.__module__` attribute?

I mean, a function's `.__module__` attribute says on which module the function 
was originally defined, but the function could be accessible on any other 
module and any other namespace or class. Its `.__module__` would remain 
constant, because it's the one place where you are guaranteed to be able to 
find the function, assuming it's defined in the top-level. So the `.__module__` 
attribute is used in unpickling the function. How is the `.__parent_class__` 
suggestion more hackish than `.__module__`?

--

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



[issue9276] pickle should support methods

2011-03-01 Thread Ram Rachum

Ram Rachum  added the comment:

Amaury: I don't think ForkingPickler works for unbound methods defined in user 
code, which are implemented as functions. I think it only works for 
method-descriptors and wrapper-descriptors.

--

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



[issue9276] pickle should support methods

2011-03-02 Thread Ram Rachum

Ram Rachum  added the comment:

Amaury:

Your example succeeds on Linux but fails on Windows:

$ python3.2 main.py
CALLED
Traceback (most recent call last):
  File "C:\Python32\Lib\pickle.py", line 679, in save_global
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'foo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 7, in 
p.start(); p.join()
  File "C:\Python32\Lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
  File "C:\Python32\Lib\multiprocessing\forking.py", line 267, in 
__init__
dump(process_obj, to_child, HIGHEST_PROTOCOL)
  File "C:\Python32\Lib\multiprocessing\forking.py", line 190, in dump
ForkingPickler(file, protocol).dump(obj)
  File "C:\Python32\Lib\pickle.py", line 237, in dump
self.save(obj)
  File "C:\Python32\Lib\pickle.py", line 344, in save
self.save_reduce(obj=obj, *rv)
  File "C:\Python32\Lib\pickle.py", line 432, in save_reduce
save(state)
  File "C:\Python32\Lib\pickle.py", line 299, in save
f(self, obj) # Call unbound method with explicit self
  File "C:\Python32\Lib\pickle.py", line 623, in save_dict
self._batch_setitems(obj.items())
  File "C:\Python32\Lib\pickle.py", line 656, in _batch_setitems
save(v)
  File "C:\Python32\Lib\pickle.py", line 299, in save
f(self, obj) # Call unbound method with explicit self
  File "C:\Python32\Lib\pickle.py", line 683, in save_global
(obj, module, name))
_pickle.PicklingError: Can't pickle : it's 
not found as mod.foo

User@TURING ~/Desktop/temp
$ Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python32\Lib\multiprocessing\forking.py", line 370, in main
self = load(from_parent)
EOFError

--

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



[issue9276] pickle should support methods

2011-03-04 Thread Ram Rachum

Ram Rachum  added the comment:

I don't have the time and the ability to write the patch that implements this. 
I'll be happy to write tests if you think this will help.

--

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



[issue11733] Implement a `Counter.elements_count` method

2011-03-31 Thread Ram Rachum

New submission from Ram Rachum :

I suggest a `Counter.elements_count()` method should be added, that would give 
the same answer as `sum(counter.itervalues())`.

--
components: Library (Lib)
messages: 132708
nosy: cool-RR, rhettinger
priority: normal
severity: normal
status: open
type: feature request
versions: Python 3.3

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



[issue11775] `bool(Counter({'a': 0'})) is True`

2011-04-05 Thread Ram Rachum

New submission from Ram Rachum :

bool(Counter({'a': 0'})) is True.

Is this wise? I want to be able to do:

if my_counter:
whatever

To check whether my counter has any elements. Currently this seems to be 
impossible because of this bug.

Will we have to keep this weird behavior because of backwards compatibility? If 
so, perhaps `.elements` could be turned into a smart object so we could at 
least do `if my_counter.elements():` and get the expected result.

If you want a patch let me know and I'll write one.

--
components: Library (Lib)
messages: 133076
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `bool(Counter({'a': 0'})) is True`
versions: Python 3.3, Python 3.4

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



[issue11775] `bool(Counter({'a': 0})) is True`

2011-04-05 Thread Ram Rachum

Changes by Ram Rachum :


--
title: `bool(Counter({'a': 0'})) is True` -> `bool(Counter({'a': 0})) is True`

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



[issue11775] `bool(Counter({'a': 0})) is True`

2011-04-05 Thread Ram Rachum

Ram Rachum  added the comment:

Before coding a test I want to know whether we can even make this change with 
regards to backwards compatibility.

--

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



[issue11775] `bool(Counter({'a': 0})) is True`

2011-04-05 Thread Ram Rachum

Ram Rachum  added the comment:

Hmm... So how about making `elements` a smart object which will implement 
`__bool__`? Then we could give it a `__len__` too and be rid of issue11733.

--

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



[issue11775] `bool(Counter({'a': 0})) is True`

2011-04-05 Thread Ram Rachum

Ram Rachum  added the comment:

How is it "not the Python way"? Why is it okay to make `dict.keys` into a smart 
object but it's not okay to make `Counter.elements` a smart object?

These are not random ideas. I'm using `Counter` in a contract project and I 
find the need to make `if counter:` checks.

I'll ask on Python-ideas to get people's opinions.

--

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



[issue11908] Weird `slice.stop or sys.maxint`

2011-04-22 Thread Ram Rachum

New submission from Ram Rachum :

In the documentation for `itertools.islice` I see this line:

it = iter(xrange(s.start or 0, s.stop or sys.maxint, s.step or 1))

Is it really okay to do `s.stop or sys.maxint`? I'm assuming this was targeting 
`None`, but what if `s.stop == 0`? And `s.step` could (pathologically) be `0` 
too, no?

--
assignee: docs@python
components: Documentation
messages: 134276
nosy: cool-RR, docs@python
priority: normal
severity: normal
status: open
title: Weird `slice.stop or sys.maxint`
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 
3.3, Python 3.4

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



[issue8400] zipimporter find_module fullname mis-documented

2011-04-27 Thread Ram Rachum

Ram Rachum  added the comment:

I was bitten now as well...

--
nosy: +cool-RR

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



[issue11969] Can't launch Process on built-in static method

2011-05-01 Thread Ram Rachum

New submission from Ram Rachum :

Hello,

I found this bit in my inbox, I forgot why I cared about it, but it raises an 
exception (at least on Windows):

>>> import multiprocessing
>>> p = multiprocessing.Process(target=bytes.maketrans, args=(b'abc', b'xyz'))
>>> p.start()
Traceback (most recent call last):
  File "C:\Python32\Lib\pickle.py", line 679, in save_global
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'maketrans'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python32\Lib\multiprocessing\process.py", line 130, in start
self._popen = Popen(self)
  File "C:\Python32\Lib\multiprocessing\forking.py", line 267, in __init__
dump(process_obj, to_child, HIGHEST_PROTOCOL)
  File "C:\Python32\Lib\multiprocessing\forking.py", line 190, in dump
ForkingPickler(file, protocol).dump(obj)
  File "C:\Python32\Lib\pickle.py", line 237, in dump
self.save(obj)
  File "C:\Python32\Lib\pickle.py", line 344, in save
self.save_reduce(obj=obj, *rv)
  File "C:\Python32\Lib\pickle.py", line 432, in save_reduce
save(state)
  File "C:\Python32\Lib\pickle.py", line 299, in save
f(self, obj) # Call unbound method with explicit self
  File "C:\Python32\Lib\pickle.py", line 623, in save_dict
self._batch_setitems(obj.items())
  File "C:\Python32\Lib\pickle.py", line 656, in _batch_setitems
save(v)
  File "C:\Python32\Lib\pickle.py", line 299, in save
f(self, obj) # Call unbound method with explicit self
  File "C:\Python32\Lib\pickle.py", line 683, in save_global
(obj, module, name))
_pickle.PicklingError: Can't pickle : it's not 
found as __main__.maketrans

If you do the same things with `threading.Thread`, it works, but for 
`multiprocessing.Process` it doesn't. Is this a general problem with pickling 
"unbound methods"?

--
components: Interpreter Core, Library (Lib)
messages: 134907
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Can't launch Process on built-in static method
type: behavior
versions: Python 3.3, Python 3.4

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



[issue11969] Can't launch multiproccessing.Process on methods

2011-05-19 Thread Ram Rachum

Ram Rachum  added the comment:

Test attached.

--
Added file: http://bugs.python.org/file22027/test.py

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



[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum

New submission from Ram Rachum :

When you create an `abc.abstractproperty` on a class, any subclass must 
override it as an actual property in order to be instantiable. But sometimes 
you want to override it with a data attribute instead, i.e. `self.x = 5` 
instead of `x = property(...)`. It would be nice if doing `self.x = 5` would 
satisfy `abc.abstractproperty` and allow the subclass to be instantiable.

--
components: Library (Lib)
messages: 136388
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Allow `abc.abstractproperty` to be overridden by a data attribute
type: feature request
versions: Python 3.3, Python 3.4

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



[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum

Ram Rachum  added the comment:

Daniel, the behavior you describe is already present in Python 3.2.

--

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



[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum

Ram Rachum  added the comment:

Eric, do you think that a solution can be made by calling `__init__` inside of 
`ABCMeta.__new__` and then afterwards checking the instance for attributes?

--

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



[issue12128] Allow `abc.abstractproperty` to be overridden by a data attribute

2011-05-20 Thread Ram Rachum

Ram Rachum  added the comment:

Ah, I got confused, there's no way we can call `__init__` in `ABCMeta.__new__`.

--

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



[issue10569] abc: `issubclass([], my_abstract_type)` raises exception

2010-11-28 Thread Ram Rachum

New submission from Ram Rachum :

>>> import abc
>>> class A(object, metaclass=abc.ABCMeta):
... pass
>>> issubclass([], A)
Traceback (most recent call last):
  File "", line 1, in 
issubclass([], A)
  File "c:\Python32\lib\abc.py", line 137, in __subclasscheck__
if subclass in cls._abc_cache:
  File "c:\Python32\lib\_weakrefset.py", line 69, in __contains__
return ref(item) in self.data
TypeError: cannot create weak reference to 'list' object

I should be able to check whether an object is a subclass of something without 
confirming it's a type first. I think this call should just return False.

--
components: Library (Lib)
messages: 122736
nosy: cool-RR
priority: normal
severity: normal
status: open
title: abc: `issubclass([], my_abstract_type)` raises exception
type: behavior
versions: Python 3.2

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



[issue10569] abc: `issubclass([], my_abstract_type)` raises exception

2010-11-28 Thread Ram Rachum

Ram Rachum  added the comment:

But do you think it's a good idea that `issubclass(1, list)` raises an 
exception? Why not simply return `False`?

Do you think there's someone out there who's counting on `issubclass` to raise 
an exception?

--
status: closed -> open

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



[issue10569] abc: `issubclass([], my_abstract_type)` raises exception

2010-11-28 Thread Ram Rachum

Ram Rachum  added the comment:

Amaury, I am aware of what `issubclass` does and what `isinstance` does. I am 
not manually feeding `[]` into `issubclass`. I have an object which can be 
either a list, or a string, or a callable, or a type. And I want to check 
whether it's a sub-class of some base class.

So I don't think I should be taking extra precautions before using 
`issubclass`: If my object is not a subclass of the given base class, I should 
just get `False`.

--

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



[issue10893] The docs mark staticmethod as a function

2011-01-12 Thread Ram Rachum

New submission from Ram Rachum :

The Python documentation uses :func:`staticmethod` to describe staticmethod, 
while staticmethod is a type.

I want to link to the Python documentation from my project's documentation 
using Intersphinx, and I wouldn't want to mislead my users by marking static 
method as a function.

--
assignee: d...@python
components: Documentation
messages: 126090
nosy: cool-RR, d...@python
priority: normal
severity: normal
status: open
title: The docs mark staticmethod as a function
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Ram Rachum

Ram Rachum  added the comment:

But why? What's the reason for that? Why mislabel a type as a function?

--

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Ram Rachum

Ram Rachum  added the comment:

I'm really confused by your comment.

"int being a function is really a CPython implementation detail"

I don't understand this. I should be able to do isinstance(x, int) in all 
implementations of Python, no? So `int` must be a class across all Python 
implementation, no?

"why would you want to consider the detail that it’s really a C function?"

I don't want to consider the detail that int is a C function, I thought that 
int is a class and expected it to be marked :class:`int` in the documentation.

--

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



[issue10893] The docs mark staticmethod as a function

2011-01-13 Thread Ram Rachum

Ram Rachum  added the comment:

So if int is officially a class, why not start doing :class:`int` instead of 
:func:`int`?

"they’re marked up as functions, so you should treat them as functions."

Here, I've treated staticmethod as a function:

>>> assert isinstance(staticmethod, types.FunctionType)
Traceback (most recent call last):
  File "", line 1, in 
assert isinstance(staticmethod, types.FunctionType)
AssertionError

I get an error.

So I understand that you are using Sphinx's :func: role in a liberal way; You 
consider it okay to use it to mark anything that is callable, regardless of 
whether it's a function or a class. Am I right?

This looks to me like an abuse of Sphinx notation. When I read documentation I 
don't want to be second-guessing the author's intentions. If someone writes 
:func:`whatever` I expect `whatever` to be a function and not a class.

Perhaps we need a :callable: role?

--
status: closed -> open

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



[issue7946] Convoy effect with I/O bound threads and New GIL

2010-03-28 Thread Ram Rachum

Changes by Ram Rachum :


--
nosy: +cool-RR

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



[issue8289] multiprocessing.Process.__init__ pickles all arguments

2010-04-02 Thread Ram Rachum

New submission from Ram Rachum :

Currently, when you create a Process, all arguments you pass to its __init__ 
get pickled. I understood this is done because arguments to __init__ almost 
always become attributes to the Process. Like this:

def MyProcess(multiprocessing.Process):
def __init__(self, whatever):
 self.whatever = whatever

Of course, attributes must be pickled so they can be accessed from the separate 
process (on Windows). And indeed in most cases all arguments to __init__ become 
attributes, so this makes sense.

But, in some cases you pass in arguments to __init__ that do not become 
attributes. In my case, __init__ takes an object, and takes some attributes of 
this object as attributes to itself. The object is unpicklable, but the 
attributes are. So I had to make some ugly workaround to make the program run.

So I think it would be better if Process would be smart enough to pickle only 
the arguments that get set as attributes.

--
components: Library (Lib)
messages: 102172
nosy: cool-RR
severity: normal
status: open
title: multiprocessing.Process.__init__ pickles all arguments
type: feature request
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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



[issue8289] multiprocessing.Process.__init__ pickles all arguments

2010-04-02 Thread Ram Rachum

Ram Rachum  added the comment:

Sorry, I accidentally typed "def" instead of "class" in my code sample.

--

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



[issue37937] Mention ``frame.f_trace`` in :func:`sys.settrace` docs.

2019-08-24 Thread Ram Rachum


Change by Ram Rachum :


--
assignee: docs@python
components: Documentation
nosy: cool-RR, docs@python
priority: normal
pull_requests: 15149
severity: normal
status: open
title: Mention ``frame.f_trace`` in :func:`sys.settrace` docs.
type: enhancement
versions: Python 3.9

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



[issue37937] Mention ``frame.f_trace`` in :func:`sys.settrace` docs.

2019-09-07 Thread Ram Rachum


Ram Rachum  added the comment:

Serhiy: I confirmed what you're saying and corrected the documentation. Could 
you please review?

--

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



[issue38422] Clarify docstrings of pathlib suffix(es)

2019-10-09 Thread Ram Rachum


New submission from Ram Rachum :

I'm writing a PR for this right now.

--
components: Library (Lib)
messages: 354279
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Clarify docstrings of pathlib suffix(es)
versions: Python 3.9

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



[issue38422] Clarify docstrings of pathlib suffix(es)

2019-10-09 Thread Ram Rachum


Change by Ram Rachum :


--
keywords: +patch
pull_requests: +16264
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/16679

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-06 Thread Ram Rachum


New submission from Ram Rachum :

I was working with a Popen object recently in the shell and it was annoying to 
see the `` display. It would be nice to get some 
kind of minimal detail about the Popen, for example its args and return code, 
if finished.

--
components: Library (Lib)
messages: 356149
nosy: cool-RR, pitrou
priority: normal
severity: normal
status: open
title: Implement subprocess.Popen.__repr__
type: enhancement
versions: Python 3.9

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-06 Thread Ram Rachum


Change by Ram Rachum :


--
nosy: +taleinat

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



[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor

2021-07-24 Thread Ram Rachum


New submission from Ram Rachum :

I love `concurrent.futures`, and I'd like to use it wherever I can. There's a 
feature in `multiprocessing.Pool` that I wish would also be available in 
`ProcessPoolExecutor`: The `maxtasksperchild` argument.

Documentation: "maxtasksperchild is the number of tasks a worker process can 
complete before it will exit and be replaced with a fresh worker process, to 
enable unused resources to be freed. The default maxtasksperchild is None, 
which means worker processes will live as long as the pool."

I want to be able to set it to 1, so each process will only execute one task 
and then be replaced with a fresh process.

--
components: Library (Lib)
messages: 398143
nosy: cool-RR, pitrou
priority: normal
severity: normal
status: open
title: Feature request: maxtasksperchild for ProcessPoolExecutor
type: enhancement
versions: Python 3.11

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



[issue44733] Feature request: maxtasksperchild for ProcessPoolExecutor

2021-07-26 Thread Ram Rachum


Ram Rachum  added the comment:

Awesome. You can link to experimental code here. Even if it were not accepted 
to Python, it could be useful for me and for other people who might see this 
issue.

--

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



[issue12653] Provide accelerators for all buttons in Windows installers

2021-10-20 Thread Ram Rachum


Ram Rachum  added the comment:

I confirmed now in the 3.10 installer on Windows that accelerators are working. 
Thank you!

--
resolution: out of date -> fixed

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



[issue28953] Use `raise from` when raising new IncompleteRead

2021-12-03 Thread Ram Rachum


Ram Rachum  added the comment:

Interesting feature Irit, thank you 

Two things:

1. Is there better documentation for that feature than what was in the CL of 
the issue you linked to? Because that documentation was more lawyery than 
explanatory.

2. If I understand correctly, the note is meant for things that don't exactly 
fit in the exception message for some reason or another. (A better 
documentation with examples would have given me a clearer understanding of your 
use cases.) I'm not sure why the message included here should be relegated to a 
note.

--

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



[issue28953] Use `raise from` when raising new IncompleteRead

2021-12-04 Thread Ram Rachum


Ram Rachum  added the comment:

This might work here, but you'd need to be sure there isn't any important code 
that looks at the IncompleteRead exception and expects the data to be in its 
message.

Also I hope that various tools like IDEs would learn quickly that they need to 
display the note in their traceback views, otherwise all of these notes would 
be hidden from many people.

--

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



[issue28953] Use `raise from` when raising new IncompleteRead

2021-12-04 Thread Ram Rachum


Ram Rachum  added the comment:

Okay, works for me.

--

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



[issue45990] Exception notes need more documentation

2021-12-05 Thread Ram Rachum


New submission from Ram Rachum :

The new __note__ feature for exception could be useful, but the documentation 
(and the section in "What's new") aren't good enough:

"__note__: A mutable field which is :const:`None` by default and can be set to 
a string. If it is not :const:`None`, it is included in the traceback. This 
field can be used to enrich exceptions after they have been caught."

This is more of a definition than an explanation. If this is solving a problem, 
there should be an explanation that starts from the problem being solved, 
hopefully with 2-3 examples where this is useful. If people start using this 
feature without some guidance, they might put things in the note that should 
have been in the message.

--
assignee: docs@python
components: Documentation
messages: 407722
nosy: cool-RR, docs@python, iritkatriel
priority: normal
severity: normal
status: open
title: Exception notes need more documentation
versions: Python 3.11

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



[issue39212] Show qualified function name when giving arguments error

2020-01-04 Thread Ram Rachum


New submission from Ram Rachum :

I recently got this familiar error:

builtins.TypeError: __init__() takes 1 positional argument but 2 were given

It was annoying that I didn't know which `__init__` method was under 
discussion. I wish that Python used the `__qualname__` of the function to show 
this error message (and maybe others?) so it'll show like this: 

builtins.TypeError: FooBar.__init__() takes 1 positional argument but 2 
were given

If I'm not mistaken, the implementation of this error is in getargs.c in the 
function vgetargs1_impl.

--
components: Interpreter Core
messages: 359302
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Show qualified function name when giving arguments error
type: enhancement
versions: Python 3.9

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



[issue39212] Show qualified function name when giving arguments error

2020-01-05 Thread Ram Rachum


Ram Rachum  added the comment:

Here is a short IPython session:

In [1]: class Foo: 
   ...: def __init__(self, x): 
   ...: pass   
   ...:
   
In [2]: Foo(7, 8)  
---
TypeError Traceback (most recent call last)
 in  
> 1 Foo(7, 8)  
   
TypeError: __init__() takes 2 positional arguments but 3 were given

As you can see, it's pretty simple to get this exception text, so I'm not sure 
why you didn't get that text. This is on Python 3.8.1.

Regarding you saying it's more annoying than useful: Especially for methods 
such as `__init__`, it's often difficult to understand which class is being 
instantiated, especially in a complex codebase. It happened to me last week at 
work, and even with a debugger and being an experienced Python developer, it 
took me a few minutes to figure out which `__init__` method was being called.

--

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



[issue39212] Show qualified function name when giving arguments error

2020-01-06 Thread Ram Rachum


Ram Rachum  added the comment:

> But I *did* get that text. I'm asking how you got the *different* text 
> which you gave in your initial request.

Oh, right. Looking back, turns out Wing IDE did that for me. Didn't notice, 
sorry.

> So in my opinion, and I recognise that you may disagree, this is only of 
> benefit in a minority of cases. For the majority of cases, it will only 
> be additional noise in the message that adds nothing that wasn't already 
> obvious from the source line.

I understand your perspective.

One correction though regarding adding noise to the error. You gave this 
example:

builtins.TypeError: package.some_module.MyClass.__init__ takes 1 positional 
argument but 2 were given

While actually it'll be:

TypeError: MyClass.__init__ takes 1 positional argument but 2 were given

Since __qualname__ only includes the class, not its module. So it's quite a bit 
shorter.

--

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



[issue39279] Don't allow non-Ascii digits in platform.py

2020-01-09 Thread Ram Rachum

New submission from Ram Rachum :

The platform.py module takes non-Ascii digits in regexes in places it 
shouldn't. e.g. digits like ٢ and 5 and accepted, when only the Ascii digits 
between 0-9 should be accepted.

--
components: Library (Lib)
messages: 359694
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Don't allow non-Ascii digits in platform.py
type: behavior
versions: Python 3.9

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



  1   2   3   4   >