summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-11-03 16:27:57 +0100
committerÉric Araujo <merwok@netwok.org>2011-11-03 16:27:57 +0100
commitbfbae77cf77ce4c0404c9549020c49d2fceee367 (patch)
tree6ae7abf454b11a5e614c93ac1dbd1e60cba1e76f
parent9bdf822e72496de5c6c63818d2e83a8d4cf51b6f (diff)
parent1a9a758a1700307cc13e909fc7f39d7d0df9fb46 (diff)
downloadcpython-bfbae77cf77ce4c0404c9549020c49d2fceee367.tar.gz
Branch merge
-rw-r--r--Doc/library/curses.rst2
-rw-r--r--Lib/test/test_curses.py7
-rw-r--r--Lib/test/test_httpservers.py8
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/_cursesmodule.c2
5 files changed, 17 insertions, 5 deletions
diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst
index 5470a10833..f31b9c536b 100644
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -566,7 +566,7 @@ The module :mod:`curses` defines the following functions:
Instantiate the string *str* with the supplied parameters, where *str* should
be a parameterized string obtained from the terminfo database. E.g.
- ``tparm(tigetstr("cup"), 5, 3)`` could result in ``'\033[6;4H'``, the exact
+ ``tparm(tigetstr("cup"), 5, 3)`` could result in ``b'\033[6;4H'``, the exact
result depending on terminal type.
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index b9ff34644b..09807834b4 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -190,7 +190,7 @@ def module_funcs(stdscr):
curses.tigetflag('hc')
curses.tigetnum('co')
curses.tigetstr('cr')
- curses.tparm('cr')
+ curses.tparm(b'cr')
curses.typeahead(sys.__stdin__.fileno())
curses.unctrl('a')
curses.ungetch('a')
@@ -264,6 +264,10 @@ def test_issue6243(stdscr):
curses.ungetch(1025)
stdscr.getkey()
+def test_issue10570():
+ b = curses.tparm(curses.tigetstr("cup"), 5, 3)
+ assert type(b) is bytes
+
def main(stdscr):
curses.savetty()
try:
@@ -272,6 +276,7 @@ def main(stdscr):
test_userptr_without_set(stdscr)
test_resize_term(stdscr)
test_issue6243(stdscr)
+ test_issue10570()
finally:
curses.resetty()
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 39ebc26338..e83c048ed9 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -259,8 +259,9 @@ class SimpleHTTPServerTestCase(BaseTestCase):
with open(os.path.join(self.tempdir_name, 'index.html'), 'w') as f:
response = self.request('/' + self.tempdir_name + '/')
self.check_status_and_reason(response, 200)
- if os.name == 'posix':
- # chmod won't work as expected on Windows platforms
+ # chmod() doesn't work as expected on Windows, and filesystem
+ # permissions are ignored by root on Unix.
+ if os.name == 'posix' and os.geteuid() != 0:
os.chmod(self.tempdir, 0)
response = self.request(self.tempdir_name + '/')
self.check_status_and_reason(response, 404)
@@ -305,6 +306,9 @@ print("%%s, %%s, %%s" %% (form.getfirst("spam"), form.getfirst("eggs"),
form.getfirst("bacon")))
"""
+
+@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
+ "This test can't be run reliably as root (issue #13308).")
class CGIHTTPServerTestCase(BaseTestCase):
class request_handler(NoLogRequestHandler, CGIHTTPRequestHandler):
pass
diff --git a/Misc/NEWS b/Misc/NEWS
index 9e7a96cc2f..993dfaec45 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -66,6 +66,9 @@ Core and Builtins
Library
-------
+- Issue #10570: curses.tigetstr() is now expecting a byte string, instead of
+ a Unicode string.
+
- Issue #2892: preserve iterparse events in case of SyntaxError.
- Issue #670664: Fix HTMLParser to correctly handle the content of
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 092fb69fb2..4f7a5258cf 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2600,7 +2600,7 @@ PyCurses_tparm(PyObject *self, PyObject *args)
PyCursesSetupTermCalled;
- if (!PyArg_ParseTuple(args, "s|iiiiiiiii:tparm",
+ if (!PyArg_ParseTuple(args, "y|iiiiiiiii:tparm",
&fmt, &i1, &i2, &i3, &i4,
&i5, &i6, &i7, &i8, &i9)) {
return NULL;