forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
19,557 additions
and
19,557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,76 @@ | ||
import unittest, os, errno | ||
from ctypes import * | ||
from ctypes.util import find_library | ||
import threading | ||
|
||
class Test(unittest.TestCase): | ||
def test_open(self): | ||
libc_name = find_library("c") | ||
if libc_name is not None: | ||
libc = CDLL(libc_name, use_errno=True) | ||
if os.name == "nt": | ||
libc_open = libc._open | ||
else: | ||
libc_open = libc.open | ||
|
||
libc_open.argtypes = c_char_p, c_int | ||
|
||
self.failUnlessEqual(libc_open("", 0), -1) | ||
self.failUnlessEqual(get_errno(), errno.ENOENT) | ||
|
||
self.failUnlessEqual(set_errno(32), errno.ENOENT) | ||
self.failUnlessEqual(get_errno(), 32) | ||
|
||
|
||
def _worker(): | ||
set_errno(0) | ||
|
||
libc = CDLL(libc_name, use_errno=False) | ||
if os.name == "nt": | ||
libc_open = libc._open | ||
else: | ||
libc_open = libc.open | ||
libc_open.argtypes = c_char_p, c_int | ||
self.failUnlessEqual(libc_open("", 0), -1) | ||
self.failUnlessEqual(get_errno(), 0) | ||
|
||
t = threading.Thread(target=_worker) | ||
t.start() | ||
t.join() | ||
|
||
self.failUnlessEqual(get_errno(), 32) | ||
set_errno(0) | ||
|
||
if os.name == "nt": | ||
|
||
def test_GetLastError(self): | ||
dll = WinDLL("kernel32", use_last_error=True) | ||
GetModuleHandle = dll.GetModuleHandleA | ||
GetModuleHandle.argtypes = [c_wchar_p] | ||
|
||
self.failUnlessEqual(0, GetModuleHandle("foo")) | ||
self.failUnlessEqual(get_last_error(), 126) | ||
|
||
self.failUnlessEqual(set_last_error(32), 126) | ||
self.failUnlessEqual(get_last_error(), 32) | ||
|
||
def _worker(): | ||
set_last_error(0) | ||
|
||
dll = WinDLL("kernel32", use_last_error=False) | ||
GetModuleHandle = dll.GetModuleHandleW | ||
GetModuleHandle.argtypes = [c_wchar_p] | ||
GetModuleHandle("bar") | ||
|
||
self.failUnlessEqual(get_last_error(), 0) | ||
|
||
t = threading.Thread(target=_worker) | ||
t.start() | ||
t.join() | ||
|
||
self.failUnlessEqual(get_last_error(), 32) | ||
|
||
set_last_error(0) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
import unittest, os, errno | ||
from ctypes import * | ||
from ctypes.util import find_library | ||
import threading | ||
|
||
class Test(unittest.TestCase): | ||
def test_open(self): | ||
libc_name = find_library("c") | ||
if libc_name is not None: | ||
libc = CDLL(libc_name, use_errno=True) | ||
if os.name == "nt": | ||
libc_open = libc._open | ||
else: | ||
libc_open = libc.open | ||
|
||
libc_open.argtypes = c_char_p, c_int | ||
|
||
self.failUnlessEqual(libc_open("", 0), -1) | ||
self.failUnlessEqual(get_errno(), errno.ENOENT) | ||
|
||
self.failUnlessEqual(set_errno(32), errno.ENOENT) | ||
self.failUnlessEqual(get_errno(), 32) | ||
|
||
|
||
def _worker(): | ||
set_errno(0) | ||
|
||
libc = CDLL(libc_name, use_errno=False) | ||
if os.name == "nt": | ||
libc_open = libc._open | ||
else: | ||
libc_open = libc.open | ||
libc_open.argtypes = c_char_p, c_int | ||
self.failUnlessEqual(libc_open("", 0), -1) | ||
self.failUnlessEqual(get_errno(), 0) | ||
|
||
t = threading.Thread(target=_worker) | ||
t.start() | ||
t.join() | ||
|
||
self.failUnlessEqual(get_errno(), 32) | ||
set_errno(0) | ||
|
||
if os.name == "nt": | ||
|
||
def test_GetLastError(self): | ||
dll = WinDLL("kernel32", use_last_error=True) | ||
GetModuleHandle = dll.GetModuleHandleA | ||
GetModuleHandle.argtypes = [c_wchar_p] | ||
|
||
self.failUnlessEqual(0, GetModuleHandle("foo")) | ||
self.failUnlessEqual(get_last_error(), 126) | ||
|
||
self.failUnlessEqual(set_last_error(32), 126) | ||
self.failUnlessEqual(get_last_error(), 32) | ||
|
||
def _worker(): | ||
set_last_error(0) | ||
|
||
dll = WinDLL("kernel32", use_last_error=False) | ||
GetModuleHandle = dll.GetModuleHandleW | ||
GetModuleHandle.argtypes = [c_wchar_p] | ||
GetModuleHandle("bar") | ||
|
||
self.failUnlessEqual(get_last_error(), 0) | ||
|
||
t = threading.Thread(target=_worker) | ||
t.start() | ||
t.join() | ||
|
||
self.failUnlessEqual(get_last_error(), 32) | ||
|
||
set_last_error(0) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
Received: from xcar [192.168.0.2] by jeeves.wooster.local | ||
(SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 | ||
Date: Sun, 12 May 2002 08:56:15 +0100 | ||
From: Father Time <[email protected]> | ||
To: [email protected] | ||
Subject: IMAP file test | ||
Message-ID: <[email protected]> | ||
X-Organization: Home | ||
User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 | ||
MIME-Version: 1.0 | ||
Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" | ||
Status: R | ||
X-UIDL: 319998302 | ||
This message is in MIME format which your mailer apparently does not support. | ||
You either require a newer version of your software which supports MIME, or | ||
a separate MIME decoding utility. Alternatively, ask the sender of this | ||
message to resend it in a different format. | ||
--1618492860--2051301190--113853680 | ||
Content-Type: text/plain; charset=us-ascii | ||
Simple email with attachment. | ||
--1618492860--2051301190--113853680 | ||
Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 | ||
Content-Disposition: attachment; filename="clock.bmp" | ||
Content-Transfer-Encoding: base64 | ||
Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA | ||
AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A | ||
zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA | ||
C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ | ||
f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// | ||
////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// | ||
8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA | ||
AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA | ||
sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 | ||
z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA | ||
AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH | ||
MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA | ||
AAAAAAAIAAAAAAAAAIAAAAAA | ||
--1618492860--2051301190--113853680-- | ||
Received: from xcar [192.168.0.2] by jeeves.wooster.local | ||
(SMTPD32-7.07 EVAL) id AFF92F0214; Sun, 12 May 2002 08:55:37 +0100 | ||
Date: Sun, 12 May 2002 08:56:15 +0100 | ||
From: Father Time <[email protected]> | ||
To: [email protected] | ||
Subject: IMAP file test | ||
Message-ID: <[email protected]> | ||
X-Organization: Home | ||
User-Agent: Messenger-Pro/2.50a (MsgServe/1.50) (RISC-OS/4.02) POPstar/2.03 | ||
MIME-Version: 1.0 | ||
Content-Type: multipart/mixed; boundary="1618492860--2051301190--113853680" | ||
Status: R | ||
X-UIDL: 319998302 | ||
|
||
This message is in MIME format which your mailer apparently does not support. | ||
You either require a newer version of your software which supports MIME, or | ||
a separate MIME decoding utility. Alternatively, ask the sender of this | ||
message to resend it in a different format. | ||
|
||
--1618492860--2051301190--113853680 | ||
Content-Type: text/plain; charset=us-ascii | ||
|
||
Simple email with attachment. | ||
|
||
|
||
--1618492860--2051301190--113853680 | ||
Content-Type: application/riscos; name="clock.bmp,69c"; type=BMP; load=&fff69c4b; exec=&355dd4d1; access=&03 | ||
Content-Disposition: attachment; filename="clock.bmp" | ||
Content-Transfer-Encoding: base64 | ||
|
||
Qk12AgAAAAAAAHYAAAAoAAAAIAAAACAAAAABAAQAAAAAAAAAAADXDQAA1w0AAAAAAAAA | ||
AAAAAAAAAAAAiAAAiAAAAIiIAIgAAACIAIgAiIgAALu7uwCIiIgAERHdACLuIgAz//8A | ||
zAAAAN0R3QDu7iIA////AAAAAAAAAAAAAAAAAAAAAAAAAAi3AAAAAAAAADeAAAAAAAAA | ||
C3ADMzMzMANwAAAAAAAAAAAHMAAAAANwAAAAAAAAAACAMAd3zPfwAwgAAAAAAAAIAwd/ | ||
f8x/f3AwgAAAAAAAgDB0x/f3//zPAwgAAAAAAAcHfM9////8z/AwAAAAAAiwd/f3//// | ||
////A4AAAAAAcEx/f///////zAMAAAAAiwfM9////3///8zwOAAAAAcHf3////B///// | ||
8DAAAAALB/f3///wd3d3//AwAAAABwTPf//wCQAAD/zAMAAAAAsEx/f///B////8wDAA | ||
AAAHB39////wf/////AwAAAACwf39///8H/////wMAAAAIcHfM9///B////M8DgAAAAA | ||
sHTH///wf///xAMAAAAACHB3f3//8H////cDgAAAAAALB3zH//D//M9wMAAAAAAAgLB0 | ||
z39///xHAwgAAAAAAAgLB3d3RHd3cDCAAAAAAAAAgLAHd0R3cAMIAAAAAAAAgAgLcAAA | ||
AAMwgAgAAAAACDAAAAu7t7cwAAgDgAAAAABzcIAAAAAAAAgDMwAAAAAAN7uwgAAAAAgH | ||
MzMAAAAACH97tzAAAAALu3c3gAAAAAAL+7tzDABAu7f7cAAAAAAACA+3MA7EQAv/sIAA | ||
AAAAAAAIAAAAAAAAAIAAAAAA | ||
|
||
--1618492860--2051301190--113853680-- |
26 changes: 13 additions & 13 deletions
26
Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# -*- coding: latin1 -*- | ||
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' | ||
# at the start of it. Make sure this is preserved if any changes | ||
# are made! Also note that the coding cookie above conflicts with | ||
# the presense of a utf-8 BOM signature -- this is intended. | ||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass | ||
# -*- coding: latin1 -*- | ||
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' | ||
# at the start of it. Make sure this is preserved if any changes | ||
# are made! Also note that the coding cookie above conflicts with | ||
# the presense of a utf-8 BOM signature -- this is intended. | ||
|
||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass |
22 changes: 11 additions & 11 deletions
22
Lib/test/tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' | ||
# at the start of it. Make sure this is preserved if any changes | ||
# are made! | ||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass | ||
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' | ||
# at the start of it. Make sure this is preserved if any changes | ||
# are made! | ||
|
||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass |
26 changes: 13 additions & 13 deletions
26
Lib/test/tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
# IMPORTANT: unlike the other test_tokenize-*.txt files, this file | ||
# does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start | ||
# of it. Make sure this is not added inadvertently by your editor | ||
# if any changes are made to this file! | ||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass | ||
# -*- coding: utf-8 -*- | ||
# IMPORTANT: unlike the other test_tokenize-*.txt files, this file | ||
# does NOT have the utf-8 BOM signature '\xef\xbb\xbf' at the start | ||
# of it. Make sure this is not added inadvertently by your editor | ||
# if any changes are made to this file! | ||
|
||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass |
24 changes: 12 additions & 12 deletions
24
Lib/test/tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# -*- coding: utf-8 -*- | ||
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' | ||
# at the start of it. Make sure this is preserved if any changes | ||
# are made! | ||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass | ||
# -*- coding: utf-8 -*- | ||
# IMPORTANT: this file has the utf-8 BOM signature '\xef\xbb\xbf' | ||
# at the start of it. Make sure this is preserved if any changes | ||
# are made! | ||
|
||
# Arbitrary encoded utf-8 text (stolen from test_doctest2.py). | ||
x = 'ЉЊЈЁЂ' | ||
def y(): | ||
""" | ||
And again in a comment. ЉЊЈЁЂ | ||
""" | ||
pass |
Oops, something went wrong.