[issue21042] ctypes.util.find_library() should return full pathname instead of filename in linux

2016-03-02 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

Is there anything else that I can do for this issue?

--

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



[issue21042] ctypes.util.find_library() should return full pathname instead of filename in linux

2016-02-22 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

Updated the patch to remove the code duplication, now it stores the values that 
are calculated in the setUpClass method. It was a good and simple idea, I 
should have come up with it... :)

I'm pretty sure I got the errors during configuration because of the gcc 
version I have.

--
Added file: http://bugs.python.org/file42003/find_lib_v4.patch

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



[issue21042] ctypes.util.find_library() should return full pathname instead of filename in linux

2016-02-21 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I've added a new method to Test_OpenGL_libs as you suggested. I check whether 
find_library returns an absolute path. Note that I didn't distinguish different 
systems, as according to the docs, only Linux systems return the file name, 
other systems return the absolute path. 
(https://docs.python.org/3.5/library/ctypes.html#ctypes-reference) An other 
thing to note, that I introduced some code duplication as I use the same code 
snippet from setUpClass method to figure out the correct parameters to 
find_library.

The patch uses the same regex as you gave.

By the way, what do I have to do to compile CPython on a 64 bit system in 32 
bit mode? I tried ./configure CC="gcc -m32" but it gave me an error. Is it the 
correct way?

Also, I signed contributor agreement.

--
Added file: http://bugs.python.org/file41992/find_lib_v3.patch

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



[issue21042] ctypes.util.find_library() should return full pathname instead of filename in linux

2016-02-20 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

What do you think about this regex?

'(lib%s\.[^\s]+\s\(%s(?:\)|,\s.*\))\s=>\s.*)' % (re.escape(name), abi_type))

It works on 64 bit, just like before, but I could not test it on 32 bit. I'll 
add tests soon.

I looked for documentation on ldconfig, but could not find anything useful.

--

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



[issue23718] strptime() can produce invalid date with negative year day

2016-02-16 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I've added a new patch, it uses an other way to calculate the number of days in 
a given year. I updated the tests, so now it doesn't fail, I also added some 
extra test cases to test leap years.

--
Added file: http://bugs.python.org/file41936/julian_date_v1.patch

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



[issue23718] strptime() can produce invalid date with negative year day

2016-02-15 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

Actually there are already test cases, but they test for the wrong behaviour. 
The very same example is tested there, but the test gives the expected result, 
so tm_yday = -3. My implementation returns 362, which looks more reasonable. So 
currently with my patch the test fails.

See the tests here: 
https://github.com/python/cpython/blob/master/Lib/test/test_strptime.py#L523

--

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



[issue24015] timeit should start with 1 loop, not 10

2016-02-10 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

Then maybe the docs should be clarified. 

"If -n is not given, a suitable number of loops is calculated by trying 
successive powers of 10 (starting from 10) until the total time is at least 0.2 
seconds."

--

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



[issue24015] timeit should start with 1 loop, not 10

2016-02-10 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I don't know what happened to this issue, but it looks good to me. So here is a 
patch for it as Joachim suggested.

$ time ./python -m timeit "import time; time.sleep(1.0)"
1 loops, best of 3: 1 sec per loop

real0m4.134s
user0m0.116s
sys 0m0.004s

--
keywords: +patch
nosy: +beng94
Added file: http://bugs.python.org/file41884/timeit_num.patch

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



[issue21042] ctypes.util.find_library() should return full pathname instead of filename in linux

2016-02-09 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I fixed the ABI matching, it was a stupid mistake, thanks for pointing it out 
:) I think now it works as expected.

I really don't find a place for testing. Maybe a new test file could be added, 
but I think the testing code for find_library wouldn't be more than 10 lines. 
Do you have any suggestions?

Thanks Martin for all your patience :)

--
Added file: http://bugs.python.org/file41866/find_lib_v2.patch

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



[issue26279] time.strptime does not properly convert out-of-bounds values

2016-02-09 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

This is connected to http://bugs.python.org/issue23718

I submitted a patch that hopefully solves this problem.

--
nosy: +beng94

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



[issue23718] strptime() can produce invalid date with negative year day

2016-02-09 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I made a patch, that solves this issue.

The problem was that there wasn't any Sunday (%w = 0) on the 0th week in 2015. 
2015 started on Thursday, therefore the first Sunday was on 2014.12.28.

julian variable is used to set the tm_yday, which was a minus value, as the 
given date was not in the same year.

--
keywords: +patch
Added file: http://bugs.python.org/file41877/julian_date.patch

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



[issue23718] strptime() can produce invalid date with negative year day

2016-02-06 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

It looks interesting, let me try to solve this. At first it seems odd that 
_calc_julian_from_U_or_W returns -2, I guess something is wrong around there.

--
nosy: +beng94

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



[issue21042] ctypes.util.find_library() should return full pathname instead of filename in linux

2016-02-06 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

Added a new patch, as Martin pointed out, I put back the ABI matching. The 
regex looks quite ugly, because it has to match \n\t. To be exact, it has to 
match something like this: "/lib/x86_64-linux-gnu/libc.so.6\n\tlibbz2.so.1.0 
(libc6,x86-64)".

I updated the docs, although I don't know what should I write for the version, 
please someone help me with that.

For testing, there's a test function in this module, I updated that.

--
Added file: http://bugs.python.org/file41835/find_lib_v1.patch

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



[issue20109] TestProgram is mentioned in the unittest docs but is not documented

2016-02-06 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I think TestProgram should be anonymous, all the work is done in its 
constructor. I don't see why would anyone would call its functions. I can 
update the docs if it's needed.

--
nosy: +beng94

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



[issue21328] Resize doesn't change reported length on create_string_buffer()

2016-02-05 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

Thanks for the remarks, I think the issue can be closed as well.

--

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



[issue21328] Resize doesn't change reported length on create_string_buffer()

2016-02-04 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I've added a patch, that solves the problem with the built-in len. Even if it 
turns out that this functionality is not needed, it was quite of a challenge to 
track down the issue, I've learned a lot. :)

Here are some functions, that I looked through, might be useful for someone, 
who'd like to look into this issue.

https://github.com/python/cpython/blob/master/Python/bltinmodule.c#L1443
static PyObject *
builtin_len(PyModuleDef *module, PyObject *obj)
/*[clinic end generated code: output=8e5837b6f81d915b input=bc55598da9e9c9b5]*/
{
Py_ssize_t res;

res = PyObject_Size(obj);
if (res < 0 && PyErr_Occurred())
return NULL;
return PyLong_FromSsize_t(res);
}

https://github.com/python/cpython/blob/master/Objects/abstract.c#L42
Py_ssize_t
PyObject_Size(PyObject *o)
{
/*...*/
m = o->ob_type->tp_as_sequence;
if (m && m->sq_length)
return m->sq_length(o);
/*...*/
}

https://github.com/python/cpython/blob/master/Modules/_ctypes/_ctypes.c#L4449
static PySequenceMethods Array_as_sequence = {
Array_length,   /* sq_length; */
/*...*/
};

https://github.com/python/cpython/blob/master/Modules/_ctypes/_ctypes.c#L4442
static Py_ssize_t
Array_length(PyObject *myself)
{
CDataObject *self = (CDataObject *)myself;
return self->b_length;
}

--
keywords: +patch
Added file: http://bugs.python.org/file41810/resize.patch

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