Hello,
I am quite new to development in python, and as a first contribution to the
community, I have provided a patch to the issue 8033 (quite trivial). I then
ran the test suite an everything was ok. However, the status has not
changed, and nobody has answered so far (patch provided one month ago). So
my question : has I missed something in the procedure that I read carefully,
to deliver a patch, or something else?
Thank you for your help, and for taking care of python.
Philippe
For those of you who don't know, the PSF has given me a two month
grant to work on the core. It's mostly focused on the long overdue
overhaul of the dev docs (now being called the devguide) and writing a
HOWTO on porting Python 2 code to Python 3. If I have time left over
it will be spent on the test suite.
I have a blog post with links to my original grant proposal at
http://sayspy.blogspot.com/2011/01/psf-core-grant-day-1.html .
Hello,
The PyPy project recently switched from svn to mercurial. Since this day I
have some
difficulties to perform simple tasks, and my questions did not receive
satisfying answers.
I was sure the Python project would have the same issues;
so I started from the repositories in http://code.python.org/hg/ and
tried simple
merges between Python versions.
I would like several people to try the same example, and tell how they
handle it.
I'm new to mercurial, and I may have missed something important!
Let's say you have to do the simple change shown in the diff below,
and want to "fix" the the 3 usual versions: py3k, release31-maint,
release27-maint.
The diff was made against py3k.
How would you do it with Mercurial? Please try to do it for real!
"hg merge" is not the correct command: it merges whole branches, a change
comes with all its ancestors. What we want is to "cherry-pick" a single
change.
"hg transplant" fails to apply the change to release31-maint because
of a tiny conflict (in the diff context!) that leaves you with an ugly
"hunks FAILED" and a .rej file you have to parse and apply by hand.
"hg transplant" seems to succeed in release27-maint,
but the test fails to run because "support" should be changed to
"test_support".
The change is already committed - to fix it another changeset is needed.
This does not look clean to me: both changesets will be pushed to the
repository,
and diff review (on the python-checkins mailing list) is almost impossible.
Furthermore, "hg transplant" does not keep track of integrations.
There is a "transplants" file, but it stays in my local clone.
Faced with a similar case in pypy, we finally manually copied the files
between directories... and the fastest with our example is probably
to do the change manually in all three directories.
There is surely a better way to work with maintenance branches!
PEP374 suggests to first modify the oldest release, but this does not
seems right to me (I have three reasons in mind)
At the moment, I feel that mercurial just cannot work for core Python
development.
At the very least before the migration we need precise use cases like this
and recipes for common cases.
Thanks for your help,
--
Amaury Forgeot d'Arc
diff -r 2777ae4d10d9 Lib/test/test_contextlib.py
--- a/Lib/test/test_contextlib.py Tue Dec 28 22:14:34 2010 +0100
+++ b/Lib/test/test_contextlib.py Wed Dec 29 00:08:18 2010 +0100
@@ -26,6 +26,7 @@
state.append(x)
self.assertEqual(state, [1, 42, 999])
+ @support.cpython_only
def test_contextmanager_finally(self):
state = []
@contextmanager
@@ -36,10 +37,10 @@
finally:
state.append(999)
with self.assertRaises(ZeroDivisionError):
- with woohoo() as x:
+ with woohoo() as y:
self.assertEqual(state, [1])
- self.assertEqual(x, 42)
- state.append(x)
+ self.assertEqual(y, 42)
+ state.append(y)
raise ZeroDivisionError()
self.assertEqual(state, [1, 42, 999])
Hello all,
In the Tools/ directory (py3k) we have a tool/directory called
"unicode". The description in Tools/README is:
unicode Tools used to generate unicode database files for
Python 2.0 (by Fredrik Lundh).
As described this is not at all useful for Python 3.2. I'm removing the
"for Python 2.0" from the description, but I would rather remove the
tool altogether.
If someone knows if this tool is still used/useful then please let us
know how the description should best be updated. If there are no replies
I'll remove it.
All the best,
Michael Foord
--
http://www.voidspace.org.uk/
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
Sorry Folks. I commited to a wrong respository.
I was testing it against the latest version py3k and I thought i moved
it back to my original respository.
Apologize for the trouble and I shall remove it immediately.
--
Senthil
On Mon, Jan 3, 2011 at 5:47 PM, senthil.kumaran
<python-checkins(a)python.org> wrote:
> Author: senthil.kumaran
> Date: Mon Jan 3 10:47:09 2011
> New Revision: 87677
>
> Log:
> py3k implmentation of RSA algorithm,
>
>
>
> Added:
> python/branches/py3k/py3rsa.py (contents, props changed)
>
> Added: python/branches/py3k/py3rsa.py
> ==============================================================================
> --- (empty file)
> +++ python/branches/py3k/py3rsa.py Mon Jan 3 10:47:09 2011
> @@ -0,0 +1,181 @@
> +# Copyright (c) 2010 Russell Dias
> +# Licensed under the MIT licence.
> +# http://www.inversezen.com
> +#
> +# This is an implementation of the RSA public key
> +# encryption written in Python by Russell Dias
> +
> +__author__ = 'Russell Dias // inversezen.com'
> +# Py3k port done by Senthil (senthil(a)uthcode.com)
> +__date__ = '05/12/2010'
> +__version__ = '0.0.1'
> +
> +import random
> +from math import log
> +
> +def gcd(u, v):
> + """ The Greatest Common Divisor, returns
> + the largest positive integer that divides
> + u with v without a remainder.
> + """
> + while v:
> + u, v = u, u % v
> + return u
> +
> +def eec(u, v):
> + """ The Extended Eculidean Algorithm
> + For u and v this algorithm finds (u1, u2, u3)
> + such that uu1 + vu2 = u3 = gcd(u, v)
> +
> + We also use auxiliary vectors (v1, v2, v3) and
> + (tmp1, tmp2, tmp3)
> + """
> + (u1, u2, u3) = (1, 0, u)
> + (v1, v2, v3) = (0, 1, v)
> + while (v3 != 0):
> + quotient = u3 // v3
> + tmp1 = u1 - quotient * v1
> + tmp2 = u2 - quotient * v2
> + tmp3 = u3 - quotient * v3
> + (u1, u2, u3) = (v1, v2, v3)
> + (v1, v2, v3) = (tmp1, tmp2, tmp3)
> + return u3, u1, u2
> +
> +def stringEncode(string):
> + """ Brandon Sterne's algorithm to convert
> + string to long
> + """
> + message = 0
> + messageCount = len(string) - 1
> +
> + for letter in string:
> + message += (256**messageCount) * ord(letter)
> + messageCount -= 1
> + return message
> +
> +def stringDecode(number):
> + """ Convert long back to string
> + """
> +
> + letters = []
> + text = ''
> + integer = int(log(number, 256))
> +
> + while(integer >= 0):
> + letter = number // (256**integer)
> + letters.append(chr(letter))
> + number -= letter * (256**integer)
> + integer -= 1
> + for char in letters:
> + text += char
> +
> + return text
> +
> +def split_to_odd(n):
> + """ Return values 2 ^ k, such that 2^k*q = n;
> + or an odd integer to test for primiality
> + Let n be an odd prime. Then n-1 is even,
> + where k is a positive integer.
> + """
> + k = 0
> + while (n > 0) and (n % 2 == 0):
> + k += 1
> + n >>= 1
> + return (k, n)
> +
> +def prime(a, q, k, n):
> + if pow(a, q, n) == 1:
> + return True
> + elif (n - 1) in [pow(a, q*(2**j), n) for j in range(k)]:
> + return True
> + else:
> + return False
> +
> +def miller_rabin(n, trials):
> + """
> + There is still a small chance that n will return a
> + false positive. To reduce risk, it is recommended to use
> + more trials.
> + """
> + # 2^k * q = n - 1; q is an odd int
> + (k, q) = split_to_odd(n - 1)
> +
> + for trial in range(trials):
> + a = random.randint(2, n-1)
> + if not prime(a, q, k, n):
> + return False
> + return True
> +
> +def get_prime(k):
> + """ Generate prime of size k bits, with 50 tests
> + to ensure accuracy.
> + """
> + prime = 0
> + while (prime == 0):
> + prime = random.randrange(pow(2,k//2-1) + 1, pow(2, k//2), 2)
> + if not miller_rabin(prime, 50):
> + prime = 0
> + return prime
> +
> +def modular_inverse(a, m):
> + """ To calculate the decryption exponent such that
> + (d * e) mod phi(N) = 1 OR g == 1 in our implementation.
> + Where m is Phi(n) (PHI = (p-1) * (q-1) )
> +
> + s % m or d (decryption exponent) is the multiplicative inverse of
> + the encryption exponent e.
> + """
> + g, s, t = eec(a, m)
> + if g == 1:
> + return s % m
> + else:
> + return None
> +
> +def key_gen(bits):
> + """ The public encryption exponent e,
> + can be an artibrary prime number.
> +
> + Obviously, the higher the number,
> + the more secure the key pairs are.
> + """
> + e = 17
> + p = get_prime(bits)
> + q = get_prime(bits)
> + d = modular_inverse(e, (p-1)*(q-1))
> + return p*q,d,e
> +
> +def write_to_file(e, d, n):
> + """ Write our public and private keys to file
> + """
> + public = open("publicKey", "w")
> + public.write(str(e))
> + public.write("\n")
> + public.write(str(n))
> + public.close()
> +
> + private = open("privateKey", "w")
> + private.write(str(d))
> + private.write("\n")
> + private.write(str(n))
> + private.close()
> +
> +
> +if __name__ == '__main__':
> + bits = input("Enter the size of your key pairs, in bits: ")
> +
> + n, d, e = key_gen(int(bits))
> +
> + #Write keys to file
> + write_to_file(e, d, n)
> +
> + print("Your keys pairs have been saved to file")
> +
> + m = input("Enter the message you would like to encrypt: ")
> +
> + m = stringEncode(m)
> + encrypted = pow(m, e, n)
> +
> + print("Your encrypted message is: %s" % encrypted)
> + decrypted = pow(encrypted, d, n)
> + message = stringDecode(decrypted)
> + print("You message decrypted is: %s" % message)
> _______________________________________________
> Python-checkins mailing list
> Python-checkins(a)python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>
--
Senthil
On 1/3/2011 4:47 AM, senthil.kumaran wrote:
> Author: senthil.kumaran
> Date: Mon Jan 3 10:47:09 2011
> New Revision: 87677
>
> Log:
> py3k implmentation of RSA algorithm,
>
>
>
> Added:
> python/branches/py3k/py3rsa.py (contents, props changed)
Did you really mean this to go in the py3k top-level directory?
Hi,
FreeBSD 7.2 3.x buildbot is red since some weeks (or months?) because of
a concurrent.futures failure. The problem is that
test_concurrent_futures uses many (multiprocessing) POSIX semaphores,
whereas POSIX semaphores support in FreeBSD is recent and limited. We
have to use SysV semaphores (ftok, semget, semop, semctl, ...) instead
of POSIX semaphores (sem_open, sem_getvalue, sem_unlink, ...). See:
* http://bugs.python.org/issue10348
* "Too many open files" errors on "x86 FreeBSD 7.2 3.x" buildbot
^-- thread in python-dev opened last month
I would like to know if it should be considered as a release blocker.
Georg Brandl said yes on IRC. Does anyone know SysV API? I tried to
write a patch, but I never used semaphores (POSIX or SysV).
There is a third party module which looks complete and stable:
http://semanchuk.com/philip/sysv_ipc/
It is released under the BSD license. It supports semaphores, but also
shared memory and message queues. We don't need all of those, semaphores
would be enough. I added its author (Philip Semanchuk) to this thread.
I don't know how we should decide to use POSIX or SysV semaphores. It
looks like SysV is preferred on FreeBSD and Darwin (and maybe all BSD
based OSes), and POSIX is preferred on Linux.
Victor
Am 30.12.2010 15:55, schrieb martin.v.loewis:
> Author: martin.v.loewis
> Date: Thu Dec 30 15:55:47 2010
> New Revision: 87577
>
> Log:
> Build and install libpython3.so.
> Modified: python/branches/py3k/configure.in
> ==============================================================================
> --- python/branches/py3k/configure.in (original)
> +++ python/branches/py3k/configure.in Thu Dec 30 15:55:47 2010
> @@ -737,6 +738,10 @@
> BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(LDVERSION)'
> RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
> INSTSONAME="$LDLIBRARY".$SOVERSION
> + if test $with_pydebug == no
> + then
> + PY3LIBRARY=libpython3.so
> + fi
> ;;
> Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
> LDLIBRARY='libpython$(LDVERSION).so'
> @@ -748,6 +753,11 @@
> ;;
> esac
> INSTSONAME="$LDLIBRARY".$SOVERSION
> + PY3LIBRARY=libpython3.so
> + if test $with_pydebug == no
> + then
> + PY3LIBRARY=libpython3.so
> + fi
> ;;
> hp*|HP*)
> case `uname -m` in
These changes do not work as written: if --with-pydebug is not given,
$with_pydebug is empty, not "no". Also, in the second case the
unconditional PY3LIBRARY assignment should probably be deleted.
cheers,
Georg
On 1/1/2011 5:07 AM, georg.brandl wrote:
> Author: georg.brandl
> Date: Sat Jan 1 11:07:30 2011
> New Revision: 87603
>
> Log:
> Fix issue references.
(add '#' to issue numbers). Whoops, two of those are mine. I am still
learning and will try to remember to include it in both log messages and
NEWS entries.
Terry