[issue19164] Update uuid.UUID TypeError exception: integer should not be an argument.

2013-10-04 Thread Marco Buccini

New submission from Marco Buccini:

When you try to use uuid.UUID() without arguments you get a TypeError exception 
saying that you can actually use an integer (while you cannot). 

Python 2.6.8 (default, Apr 26 2013, 16:24:53) 
[GCC 4.6.3] on linux2
 uuid.UUID()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/uuid.py, line 129, in __init__
raise TypeError('need one of hex, bytes, bytes_le, fields, or int')
TypeError: need one of hex, bytes, bytes_le, fields, or int

 uuid.UUID(uuid.uuid4().int)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/uuid.py, line 131, in __init__
hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'long' object has no attribute 'replace'

So, let's check with an integer - maybe an int has 'replace'.
 uuid.UUID(1231231)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/uuid.py, line 131, in __init__
hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'int' object has no attribute 'replace'

No, it doesn't. Anyway, with a propery hex value, it works (of course!).

 uuid.UUID(uuid.uuid4().hex)
UUID('89b1283d-c32e-4b8a-a9e3-a699445fdd4d')

--
assignee: docs@python
components: Documentation
messages: 198943
nosy: docs@python, makronized
priority: normal
severity: normal
status: open
title: Update uuid.UUID TypeError exception: integer should not be an argument.
type: behavior
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19164
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6975] symlinks incorrectly resolved on POSIX platforms

2013-01-14 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


--
nosy:  -markon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6975
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2013-01-14 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


--
nosy:  -markon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2013-01-14 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


--
nosy:  -markon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6074
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15098] TypeError can give a misleading message

2012-06-17 Thread Marco Buccini

New submission from Marco Buccini marcu...@gmail.com:

Suppose that you have an instance method that takes 2 arguments: one is 
required, while the other is a keyword argument. 

If you call that method without passing the required argument, but instead you 
only set the keyword argument, then you will get a TypeError exception, 
claiming this ...
 - TypeError: 'method' takes at least 2 arguments (2 given)

(I am referring to this particular method: 
http://www.voidspace.org.uk/python/mock/mock.html#mock.Mock.mock_add_spec)

@patch('xyz.subprocess.Popen')
def test_xyz(self, mocked_popen):
mocked_popen.mock_add_spec(spec_set=True)

I think the right error message should be different, in particular should be 
this:
 - TypeError: 'method' takes at least 2 arguments (1 given)

--
components: Interpreter Core
messages: 163072
nosy: markon
priority: normal
severity: normal
status: open
title: TypeError can give a misleading message
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15098
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9830] Python 2.7 x64 not properly installed on Windows 7 (registry)

2010-09-11 Thread Marco Buccini

New submission from Marco Buccini marcu...@gmail.com:

I've just installed Python 2.7 x86-64, on my 64-bit Windows 7, then I've tried 
to install some packages - such as setuptools and pyside - but a message during 
the installation said something like Cannot find Python2.7 in the windows 
registry.

So I've removed the 64-bit version of Python, then I've installed that one of 
32-bit and, as expected, it works fine.

I've also tried to search on google to see if it's a Python bug or not, but 
I've found only this unreachable link: http://bugs.python.org/setuptools/issue2

Do you confirm this bug?

--
components: Installation
messages: 116083
nosy: markon
priority: normal
severity: normal
status: open
title: Python 2.7 x64 not properly installed on Windows 7 (registry)
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9830
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6975] symlinks incorrectly resolved on Linux

2009-10-18 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

Thanks for looking deeper into it.
I would like to check the solution ASAP.
We have really crazy dir structure which can catch a lot of
the unexpected problems with paths, links, circular links etc.

Oh well, so you can see if the patch works correctly on all paths :)
 
Should I expect the new version to generate the exception
as you suggested?

 
Unfortunately I'm not God, so I cannot change the code of the current
implementation of os.path.realpath (raising an OSError exception)
without breaking any existing code. 
So, consider using the current implementation of os.path.realpath ;)
If you experience other strange behaviors, then open a new bug report.

Bye!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6975
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1646838] os.path, %HOME% set: realpath contradicts expanduser on '~'

2009-10-18 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

If we decide to follow paths as '~' it means that we want to follow the
POSIX standard.

Infact, it doesn't make sense calling os.path.realpath as follow:
 import os
 os.getcwd()
'/home/marco/Desktop'
 os.path.realpath('~')
To get something like:
'/home/marco/Desktop/$HOME' 
that would expand as:
'/home/marco/Desktop/home/marco' 

At this point we should implement a new os.path.realpath to check if the
path passed as argument exists [ See ERRORS section:
http://www.opengroup.org/onlinepubs/9699919799/functions/realpath.html
]. But this means that in the worst case, we would raise an Exception
(i.e., OSError).

As I've said [ here: http://bugs.python.org/issue6975 ] we cannot
implement a POSIX compliant os.path.realpath, since it would break with
existing code. You understand that a change like this is an API change. 

I think Python will have an own `realpath` version, not fully
POSIX-compliant, unluckly.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1646838
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7158] os.path.basename/split fails

2009-10-17 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

I think this is not a Python bug, since it concerns PyQt. 

You're passing a QString object to os.path.split(), while the official
documentation wants you pass a Python string.

However, when I tried to run your example, newWF.py, and tried to open a
file from the menu, I got this:

controls.nch: 1024
Controls Window data shape: (511, 1024)
Data file: None
/home/marco/Programmi/Python-2.6.3/pyconfig.h
Traceback (most recent call last):
  File issue7158.py, line 277, in openDataFile
head,tail = os.path.split(filename)
  File /usr/lib/python2.5/posixpath.py, line 77, in split
i = p.rfind('/') + 1
AttributeError: 'QString' object has no attribute 'rfind'

Why does this happen? 
`filename` is a QString object. (you can see why here:
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qfiledialog.html#getOpenFileName
)

So how do you split your filename? I don't know.

I should close this bug.

--
nosy: +markon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7158
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7158] os.path.basename/split fails

2009-10-17 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

 I should close this bug.

I *would* close this bug. Sorry :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7158
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7158] os.path.basename/split fails

2009-10-17 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

I cannot close this bug, ahah :)

BTW: I'm happy you solved this bug.
Bye.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7158
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1646838] os.path, %HOME% set: realpath contradicts expanduser on '~'

2009-10-17 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


--
nosy: +markon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1646838
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6975] symlinks incorrectly resolved on Linux

2009-10-17 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


--
nosy: +brett.cannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6975
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6975] symlinks incorrectly resolved on Linux

2009-10-17 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

I've just found a similar bug:
http://bugs.python.org/issue1646838

However, does os.path.realpath's behavior have to be as the one
specified by the POSIX standard (
http://www.kernel.org/doc/man-pages/online/pages/man3/realpath.3.html )?
If we wanted to follow the standard, we should break the
retro-compatibility, since we should raise an exception in the case the
path passed as argument doesn't exist.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6975
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6975] symlinks incorrectly resolved on Linux

2009-10-16 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

I've provided a patch.

I've also added a new test, and it passes.

--
keywords: +patch
nosy: +markon
Added file: http://bugs.python.org/file15150/issue6975.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6975
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

I agree with Milko. 

However, I think Popen.send_signal should poll() before sending any
signals, without resetting any variables to zero (or None).
In this way, if you poll() before sending a signal, if the return code
is None, the child is still running. If the poll return code is
different than None, the child has been terminated, so you must not send
anything to the child process.

In this way, instead of polling before sending signals to check if the
child has been terminated, we can make Python do the work for us.

I've provided a patch. All the tests pass.
A new test has been added: test_terminate_already_terminated_child.
This method asserts `terminate()` (through `send_signal`) raises an
OSError exception. 

However, even though you try the old version of subprocess.py all the
tests pass. This happens because the method `send_signal` calls
os.kill() (or Terminate for Windows systems) that can raise an OSError
exception if the process to which it send the signal does not exist. 
`send_signal` has been fixed to be a safer method, so that it raises an
OSError exception if the child has been terminated.

--
keywords: +patch
nosy: +markon
Added file: http://bugs.python.org/file15135/subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Added file: http://bugs.python.org/file15136/test_subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Removed file: http://bugs.python.org/file15136/test_subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Added file: http://bugs.python.org/file15137/test_subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Removed file: http://bugs.python.org/file15135/subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Added file: http://bugs.python.org/file15141/subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Removed file: http://bugs.python.org/file15141/subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Removed file: http://bugs.python.org/file15137/test_subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Added file: http://bugs.python.org/file15142/test_subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6973] subprocess.Popen.send_signal doesn't check whether the process has terminated

2009-10-15 Thread Marco Buccini

Changes by Marco Buccini marcu...@gmail.com:


Added file: http://bugs.python.org/file15143/subprocess.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6070] Python 2.6 makes .pyc/.pyo bytecode files executable

2009-07-07 Thread Marco Buccini

Marco Buccini marcu...@gmail.com added the comment:

@r.david.murray:
Does this works on Windows? Are you sure Oleg? :)
Since you've done this:
#ifndef MS_WINDOWS
 /* mode = ..*/
#endif

but on Windows the compiler jumps over this code, so you can get a
binding error, since it doesn't find the variable mode...

E.g (on my Debian):

#ifndef __GNUC__
 #define X 10
#endif

int main()
{
printf(%d\n, X);
}

it gives error: ‘X’ undeclared (first use in this function)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6070
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com