summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-04 12:10:01 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-04 12:10:01 (GMT)
commitc4cb3b8aa14540f730f82f64add243d6ba8b6fcd (patch)
treef5cd6e28541f62a3e6ee38d69b9247f274fe8dc9 /Python
parent5894ba7fad07dbf07ac76aedf0fb2f70fb42d40e (diff)
downloadcpython-c4cb3b8aa14540f730f82f64add243d6ba8b6fcd.zip
cpython-c4cb3b8aa14540f730f82f64add243d6ba8b6fcd.tar.gz
cpython-c4cb3b8aa14540f730f82f64add243d6ba8b6fcd.tar.bz2
Applied patch #1379 with a minor tweak.
PyModule_GetName() returns a char* from PyUnicode_AsString but the code in import.c was using PyString_FromString on it.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index be456f1..a096519 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2384,7 +2384,7 @@ PyImport_ReloadModule(PyObject *m)
subname = name;
else {
PyObject *parentname, *parent;
- parentname = PyString_FromStringAndSize(name, (subname-name));
+ parentname = PyUnicode_FromStringAndSize(name, (subname-name));
if (parentname == NULL) {
imp_modules_reloading_clear();
return NULL;
@@ -2393,7 +2393,7 @@ PyImport_ReloadModule(PyObject *m)
if (parent == NULL) {
PyErr_Format(PyExc_ImportError,
"reload(): parent %.200s not in sys.modules",
- PyString_AS_STRING(parentname));
+ PyUnicode_AsString(parentname));
Py_DECREF(parentname);
imp_modules_reloading_clear();
return NULL;
ormTests.py
+++ b/src/engine/SCons/Platform/PlatformTests.py
@@ -187,11 +187,29 @@ class TempFileMungeTestCase(unittest.TestCase):
assert cmd != defined_cmd, cmd
assert cmd == getattr(target[0].attributes, 'tempfile_cmdlist', None)
+class PlatformEscapeTestCase(unittest.TestCase):
+ def test_posix_escape(self):
+ """ Check that paths with parens are escaped properly
+ """
+ import SCons.Platform.posix
+
+ test_string = "/my (really) great code/main.cpp"
+ output = SCons.Platform.posix.escape(test_string)
+
+ # We expect the escape function to wrap the string
+ # in quotes, but not escape any internal characters
+ # in the test_string. (Parens doesn't require shell
+ # escaping if their quoted)
+ assert output[1:-1] == test_string
+
+
if __name__ == "__main__":
suite = unittest.TestSuite()
tclasses = [ PlatformTestCase,
- TempFileMungeTestCase ]
+ TempFileMungeTestCase,
+ PlatformEscapeTestCase,
+ ]
for tclass in tclasses:
names = unittest.getTestCaseNames(tclass, 'test_')
suite.addTests(list(map(tclass, names)))
diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py