Commit 021b8811 authored by Benjamin Peterson's avatar Benjamin Peterson

merge heads

parents 43716e25 0658bfff
...@@ -27,8 +27,9 @@ ...@@ -27,8 +27,9 @@
**.zip = BIN **.zip = BIN
Lib/email/test/data/msg_26.txt = BIN Lib/email/test/data/msg_26.txt = BIN
Lib/test/sndhdrdata/sndhdr.* = BIN Lib/test/cjkencodings/* = BIN
Lib/test/decimaltestdata/*.decTest = BIN Lib/test/decimaltestdata/*.decTest = BIN
Lib/test/sndhdrdata/sndhdr.* = BIN
# All other files (which presumably are human-editable) are "native". # All other files (which presumably are human-editable) are "native".
# This must be the last rule! # This must be the last rule!
......
...@@ -314,7 +314,7 @@ the result in a named tuple:: ...@@ -314,7 +314,7 @@ the result in a named tuple::
>>> from collections import namedtuple >>> from collections import namedtuple
>>> Student = namedtuple('Student', 'name serialnum school gradelevel') >>> Student = namedtuple('Student', 'name serialnum school gradelevel')
>>> Student._make(unpack('<10sHHb', s)) >>> Student._make(unpack('<10sHHb', record))
Student(name='raymond ', serialnum=4658, school=264, gradelevel=8) Student(name='raymond ', serialnum=4658, school=264, gradelevel=8)
The ordering of format characters may have an impact on size since the padding The ordering of format characters may have an impact on size since the padding
......
...@@ -455,10 +455,9 @@ and of course it would print:: ...@@ -455,10 +455,9 @@ and of course it would print::
shopkeeper : Michael Palin shopkeeper : Michael Palin
sketch : Cheese Shop Sketch sketch : Cheese Shop Sketch
Note that the :meth:`sort` method of the list of keyword argument names is Note that the list of keyword argument names is created by sorting the result
called before printing the contents of the ``keywords`` dictionary; if this is of the keywords dictionary's ``keys()`` method before printing its contents;
not done, the order in which the arguments are printed is undefined. if this is not done, the order in which the arguments are printed is undefined.
.. _tut-arbitraryargs: .. _tut-arbitraryargs:
......
...@@ -26,6 +26,7 @@ import tkMessageBox ...@@ -26,6 +26,7 @@ import tkMessageBox
from idlelib import PyShell from idlelib import PyShell
from idlelib.configHandler import idleConf from idlelib.configHandler import idleConf
from idlelib import macosxSupport
IDENTCHARS = string.ascii_letters + string.digits + "_" IDENTCHARS = string.ascii_letters + string.digits + "_"
...@@ -53,6 +54,9 @@ class ScriptBinding: ...@@ -53,6 +54,9 @@ class ScriptBinding:
self.flist = self.editwin.flist self.flist = self.editwin.flist
self.root = self.editwin.root self.root = self.editwin.root
if macosxSupport.runningAsOSXApp():
self.editwin.text_frame.bind('<<run-module-event-2>>', self._run_module_event)
def check_module_event(self, event): def check_module_event(self, event):
filename = self.getfilename() filename = self.getfilename()
if not filename: if not filename:
...@@ -166,6 +170,19 @@ class ScriptBinding: ...@@ -166,6 +170,19 @@ class ScriptBinding:
interp.runcode(code) interp.runcode(code)
return 'break' return 'break'
if macosxSupport.runningAsOSXApp():
# Tk-Cocoa in MacOSX is broken until at least
# Tk 8.5.9, and without this rather
# crude workaround IDLE would hang when a user
# tries to run a module using the keyboard shortcut
# (the menu item works fine).
_run_module_event = run_module_event
def run_module_event(self, event):
self.editwin.text_frame.after(200,
lambda: self.editwin.text_frame.event_generate('<<run-module-event-2>>'))
return 'break'
def getfilename(self): def getfilename(self):
"""Get source filename. If not saved, offer to save (or create) file """Get source filename. If not saved, offer to save (or create) file
......
...@@ -621,7 +621,7 @@ locale_encoding_alias = { ...@@ -621,7 +621,7 @@ locale_encoding_alias = {
'tactis': 'TACTIS', 'tactis': 'TACTIS',
'euc_jp': 'eucJP', 'euc_jp': 'eucJP',
'euc_kr': 'eucKR', 'euc_kr': 'eucKR',
'utf_8': 'UTF8', 'utf_8': 'UTF-8',
'koi8_r': 'KOI8-R', 'koi8_r': 'KOI8-R',
'koi8_u': 'KOI8-U', 'koi8_u': 'KOI8-U',
# XXX This list is still incomplete. If you know more # XXX This list is still incomplete. If you know more
......
...@@ -2239,12 +2239,14 @@ class TarFile(object): ...@@ -2239,12 +2239,14 @@ class TarFile(object):
if hasattr(os, "symlink") and hasattr(os, "link"): if hasattr(os, "symlink") and hasattr(os, "link"):
# For systems that support symbolic and hard links. # For systems that support symbolic and hard links.
if tarinfo.issym(): if tarinfo.issym():
if os.path.exists(targetpath): if os.path.lexists(targetpath):
os.unlink(targetpath) os.unlink(targetpath)
os.symlink(tarinfo.linkname, targetpath) os.symlink(tarinfo.linkname, targetpath)
else: else:
# See extract(). # See extract().
if os.path.exists(tarinfo._link_target): if os.path.exists(tarinfo._link_target):
if os.path.lexists(targetpath):
os.unlink(targetpath)
os.link(tarinfo._link_target, targetpath) os.link(tarinfo._link_target, targetpath)
else: else:
self._extract_member(self._find_link_target(tarinfo), targetpath) self._extract_member(self._find_link_target(tarinfo), targetpath)
......
如何在 Python 中使用既有的 C library?
 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
library, 並有一個 fast prototyping 的 programming language 可
供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
fast prototyping 的 programming language. 故我們希望能將既有的
C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
要討論的問題就是:
如何在 Python 中使用既有的 C library?
 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
library, 並有一個 fast prototyping 的 programming language 可
供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
fast prototyping 的 programming language. 故我們希望能將既有的
C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
要討論的問題就是:
𠄌Ě鵮罓洆
ÊÊ̄ê êê̄
똠방각하 펲시콜라
㉯㉯납!! 因九月패믤릔궈 ⓡⓖ훀¿¿¿ 긍뒙 ⓔ뎨 ㉯. .
亞영ⓔ능횹 . . . . 서울뤄 뎐학乙 家훀 ! ! !ㅠ.ㅠ
흐흐흐 ㄱㄱㄱ☆ㅠ_ㅠ 어릨 탸콰긐 뎌응 칑九들乙 ㉯드긐
설릌 家훀 . . . . 굴애쉌 ⓔ궈 ⓡ릘㉱긐 因仁川女中까즼
와쒀훀 ! ! 亞영ⓔ 家능궈 ☆上관 없능궈능 亞능뒈훀 글애듴
ⓡ려듀九 싀풔숴훀 어릨 因仁川女中싁⑨들앜!! ㉯㉯납♡ ⌒⌒*
寞陝 藥搋
阱阱陶!! 孻朐篘掬 佺來麗000 晤 供絨 阱. .
銢艙供棟 . . . . 憮選瘀 粟錟 坅麗 ! ! !壬.壬
 丑丑丑≧壬_壬 橫 攣攜 筑擬 疲朐菟錟 阱萄
撲 坅麗 . . . . 掉擁 供掬 佺阬 孻嬬藿澇齌梱
諦冀麗 ! ! 銢艙供 坅棟掬 ≧葞婦 橈棟掬棟 銢棟華麗 旋擁
佺溥菽朐 膜麗 橫 孻嬬藿澇齌剁菟!! 阱阱陶Ⅴ ÷÷*
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
ノか゚ ト゚ トキ喝塀 𡚴𪎌 麀齁𩛰
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
ノ トキ
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
◎ 파이썬(Python)은 배우기 쉽고, 강력한 프로그래밍 언어입니다. 파이썬은
효율적인 고수준 데이터 구조와 간단하지만 효율적인 객체지향프로그래밍을
지원합니다. 파이썬의 우아(優雅)한 문법과 동적 타이핑, 그리고 인터프리팅
환경은 파이썬을 스크립팅과 여러 분야에서와 대부분의 플랫폼에서의 빠른
애플리케이션 개발을 할 수 있는 이상적인 언어로 만들어줍니다.
☆첫가끝: 날아라 쓔쓔쓩~ 닁큼! 뜽금없이 전홥니다. 뷁. 그런거 읎다.
◎ 파이썬(Python)은 배우기 쉽고, 강력한 프로그래밍 언어입니다. 파이썬은
효율적인 고수준 데이터 구조와 간단하지만 효율적인 객체지향프로그래밍을
지원합니다. 파이썬의 우아(優雅)한 문법과 동적 타이핑, 그리고 인터프리팅
환경은 파이썬을 스크립팅과 여러 분야에서와 대부분의 플랫폼에서의 빠른
애플리케이션 개발을 할 수 있는 이상적인 언어로 만들어줍니다.
☆첫가끝: 날아라 ㅤㅆㅠㅤㅤㅆㅠㅤ쓩~ ㅤㄴㅢㅇ큼! ㅤㄸㅡㅇ금없이 전ㅤㅎㅘㅂ니다. ㅤㅂㅞㄺ. 그런거 ㅤㅇㅡㅄ다.
Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
如何在 Python 中使用既有的 C library?
 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
library, 並有一個 fast prototyping 的 programming language 可
供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
fast prototyping 的 programming language. 故我們希望能將既有的
C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
要討論的問題就是:
파이썬은 강력한 기능을 지닌 범용 컴퓨터 프로그래밍 언어다.
Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
如何在 Python 中使用既有的 C library?
 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
library, 並有一個 fast prototyping 的 programming language 可
供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
fast prototyping 的 programming language. 故我們希望能將既有的
C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
要討論的問題就是:
파이썬은 강력한 기능을 지닌 범용 컴퓨터 프로그래밍 언어다.
Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
如何在 Python 中使用既有的 C library?
 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
library, 並有一個 fast prototyping 的 programming language 可
供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
fast prototyping 的 programming language. 故我們希望能將既有的
C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
要討論的問題就是:
Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
如何在 Python 中使用既有的 C library?
 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
library, 並有一個 fast prototyping 的 programming language 可
供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
fast prototyping 的 programming language. 故我們希望能將既有的
C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
要討論的問題就是:
똠방각하 펲시콜라
㉯㉯납!! 因九月패믤릔궈 ⓡⓖ훀¿¿¿ 긍뒙 ⓔ뎨 ㉯. .
亞영ⓔ능횹 . . . . 서울뤄 뎐학乙 家훀 ! ! !ㅠ.ㅠ
흐흐흐 ㄱㄱㄱ☆ㅠ_ㅠ 어릨 탸콰긐 뎌응 칑九들乙 ㉯드긐
설릌 家훀 . . . . 굴애쉌 ⓔ궈 ⓡ릘㉱긐 因仁川女中까즼
와쒀훀 ! ! 亞영ⓔ 家능궈 ☆上관 없능궈능 亞능뒈훀 글애듴
ⓡ려듀九 싀풔숴훀 어릨 因仁川女中싁⑨들앜!! ㉯㉯납♡ ⌒⌒*
wba \ũa
s!! gÚ zٯٯٯ w ѕ . .
<wѓws . . . . ᶉ eb ;z ! ! !A.A
aaa AAAiA_A ៚ ȡz aw ×✗i az
z ;z . . . . ъ ޟ‹z gbIa
z ! ! <w ;w i꾉 ww <wz iz
ޝaA Ρz ៚ gbI鯂iz!! sٽ bb*
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
ノか゚ ト゚ トキ喝塀 𡚴𪎌 麀齁𩛰
Python の開発は、1990 年ごろから開始されています。
開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
ノ トキ
This diff is collapsed.
...@@ -9,7 +9,7 @@ from test import test_support as support ...@@ -9,7 +9,7 @@ from test import test_support as support
FILENAME = linecache.__file__ FILENAME = linecache.__file__
INVALID_NAME = '!@$)(!@#_1' INVALID_NAME = '!@$)(!@#_1'
EMPTY = '' EMPTY = ''
TESTS = 'cjkencodings_test inspect_fodder inspect_fodder2 mapping_tests' TESTS = 'inspect_fodder inspect_fodder2 mapping_tests'
TESTS = TESTS.split() TESTS = TESTS.split()
TEST_PATH = os.path.dirname(support.__file__) TEST_PATH = os.path.dirname(support.__file__)
MODULES = "linecache abc".split() MODULES = "linecache abc".split()
......
...@@ -4,8 +4,11 @@ ...@@ -4,8 +4,11 @@
# Common Unittest Routines for CJK codecs # Common Unittest Routines for CJK codecs
# #
import sys, codecs import codecs
import unittest, re import os
import re
import sys
import unittest
from httplib import HTTPException from httplib import HTTPException
from test import test_support from test import test_support
from StringIO import StringIO from StringIO import StringIO
...@@ -326,6 +329,10 @@ class TestBase_Mapping(unittest.TestCase): ...@@ -326,6 +329,10 @@ class TestBase_Mapping(unittest.TestCase):
self.fail('Decoding failed while testing %s -> %s: %s' % ( self.fail('Decoding failed while testing %s -> %s: %s' % (
repr(csetch), repr(unich), exc.reason)) repr(csetch), repr(unich), exc.reason))
def load_teststring(encoding): def load_teststring(name):
from test import cjkencodings_test dir = os.path.join(os.path.dirname(__file__), 'cjkencodings')
return cjkencodings_test.teststring[encoding] with open(os.path.join(dir, name + '.txt'), 'rb') as f:
encoded = f.read()
with open(os.path.join(dir, name + '-utf8.txt'), 'rb') as f:
utf8 = f.read()
return encoded, utf8
...@@ -872,6 +872,66 @@ class WriteTest(WriteTestBase): ...@@ -872,6 +872,66 @@ class WriteTest(WriteTestBase):
os.unlink(temparchive) os.unlink(temparchive)
shutil.rmtree(tempdir) shutil.rmtree(tempdir)
@unittest.skipUnless(hasattr(os, 'symlink'), "needs os.symlink")
def test_extractall_broken_symlinks(self):
# Test if extractall works properly when tarfile contains broken
# symlinks
tempdir = os.path.join(TEMPDIR, "testsymlinks")
temparchive = os.path.join(TEMPDIR, "testsymlinks.tar")
os.mkdir(tempdir)
try:
source_file = os.path.join(tempdir,'source')
target_file = os.path.join(tempdir,'symlink')
with open(source_file,'w') as f:
f.write('something\n')
os.symlink(source_file, target_file)
tar = tarfile.open(temparchive,'w')
tar.add(target_file, arcname=os.path.basename(target_file))
tar.close()
# remove the real file
os.unlink(source_file)
# Let's extract it to the location which contains the symlink
tar = tarfile.open(temparchive,'r')
# this should not raise OSError: [Errno 17] File exists
try:
tar.extractall(path=tempdir)
except OSError:
self.fail("extractall failed with broken symlinked files")
finally:
tar.close()
finally:
os.unlink(temparchive)
shutil.rmtree(tempdir)
@unittest.skipUnless(hasattr(os, 'link'), "needs os.link")
def test_extractall_hardlinks(self):
# Test if extractall works properly when tarfile contains symlinks
tempdir = os.path.join(TEMPDIR, "testsymlinks")
temparchive = os.path.join(TEMPDIR, "testsymlinks.tar")
os.mkdir(tempdir)
try:
source_file = os.path.join(tempdir,'source')
target_file = os.path.join(tempdir,'symlink')
with open(source_file,'w') as f:
f.write('something\n')
os.link(source_file, target_file)
tar = tarfile.open(temparchive,'w')
tar.add(source_file, arcname=os.path.basename(source_file))
tar.add(target_file, arcname=os.path.basename(target_file))
tar.close()
# Let's extract it to the location which contains the symlink
tar = tarfile.open(temparchive,'r')
# this should not raise OSError: [Errno 17] File exists
try:
tar.extractall(path=tempdir)
except OSError:
self.fail("extractall failed with linked files")
finally:
tar.close()
finally:
os.unlink(temparchive)
shutil.rmtree(tempdir)
class StreamWriteTest(WriteTestBase): class StreamWriteTest(WriteTestBase):
mode = "w|" mode = "w|"
......
...@@ -80,6 +80,12 @@ Core and Builtins ...@@ -80,6 +80,12 @@ Core and Builtins
Library Library
------- -------
- Issue #11088: don't crash when using F5 to run a script in IDLE on MacOSX
with Tk 8.5.
- Issue #10154, #10090: change the normalization of UTF-8 to "UTF-8" instead
of "UTF8" in the locale module as the latter is not supported MacOSX and OpenBSD.
- Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET is - Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET is
set in shell. set in shell.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment