Skip to content

Instantly share code, notes, and snippets.

@eli-collins
eli-collins / py3_unicode_prefix.patch
Created December 9, 2011 19:05
patch against Python 3.3 source to re-enable u'' prefixes
diff -r f1cafe6f7834 Lib/test/test_builtin.py
--- a/Lib/test/test_builtin.py Sun Nov 20 16:01:35 2011 +0100
+++ b/Lib/test/test_builtin.py Fri Dec 09 14:04:31 2011 -0500
@@ -437,6 +437,14 @@
self.assertRaises(TypeError, eval, ())
self.assertRaises(SyntaxError, eval, bom[:2] + b'a')
+ # test 2.x u'...' syntax
+ self.assertEqual(eval('u"abc"'), "abc")
+ self.assertEqual(eval(r'ur"a\bc"'), "a\\bc")
@eli-collins
eli-collins / toxmatch.py
Created November 23, 2016 16:05
Helper for running tox
#!/usr/bin/env python
"""
Quick script that returns list of TOX envs, after applying pattern expansion.
Usage example:
$ toxmatch {foo,bar}-py{2,3}
foo-py2,foo-py3,bar-py2,bar-py3
"""
from __future__ import print_function
import sys
import subprocess