python / cpython

The Python programming language
https://www.python.org
Other
63.19k stars 30.26k forks source link

binhex REASONABLY_LARGE = 32768 so what is 128000 #78244

Closed 74c4563b-ab1c-43d8-9219-30c4eca796bc closed 2 years ago

74c4563b-ab1c-43d8-9219-30c4eca796bc commented 6 years ago
BPO 34063
Nosy @jimjjewett, @tirkarthi

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = None closed_at = None created_at = labels = ['3.8', 'type-feature', 'library', 'docs'] title = 'binhex REASONABLY_LARGE = 32768 so what is 128000' updated_at = user = 'https://github.com/JimJJewett' ``` bugs.python.org fields: ```python activity = actor = 'xtreak' assignee = 'docs@python' closed = False closed_date = None closer = None components = ['Documentation', 'Library (Lib)'] creation = creator = 'Jim.Jewett' dependencies = [] files = [] hgrepos = [] issue_num = 34063 keywords = [] message_count = 2.0 messages = ['321193', '321626'] nosy_count = 3.0 nosy_names = ['docs@python', 'Jim.Jewett', 'xtreak'] pr_nums = [] priority = 'low' resolution = None stage = 'needs patch' status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue34063' versions = ['Python 3.8'] ```

74c4563b-ab1c-43d8-9219-30c4eca796bc commented 6 years ago

binhex defines a module-wide constant of

REASONABLY_LARGE = 32768  # Minimal amount we pass the rle-coder

Later on, in 5 locations it does either ifp.read(128000) or ifp.read_rsrc(128000)

It isn't clear why a different constant is used, let alone why a literal is used instead of something like REASONABLY_LARGE.

tirkarthi commented 6 years ago

I tried changing it to REASONABLY_LARGE and could see no test failures. It seems the literal was added as part of a220e67a9ed94d66b81e393a3bb9e6acd10068c1 (23/03/1996) and REASONABLY_LARGE was before that as added part of fcdffeaaa144147f43224a641b668df539ffb6fe (07/08/1995)

➜ cpython git:(master) time ./python -Werror -m unittest -v test.test_binhex test_binhex (test.test_binhex.BinHexTestCase) ... ok test_binhex_error_on_long_filename (test.test_binhex.BinHexTestCase) ... ok

---------------------------------------------------------------------- Ran 2 tests in 0.002s

OK ./python -Werror -m unittest -v test.test_binhex 0.23s user 0.03s system 93% cpu 0.279 total

hugovk commented 2 years ago

Closing as the binhex module has been removed in Python 3.11, after being deprecated since 3.9:

cc @JimJJewett, @tirkarthi