René's URL Explorer Experiment


Title: Empty read from gitdb.OStream.read() before EOF · Issue #120 · gitpython-developers/gitdb · GitHub

Open Graph Title: Empty read from gitdb.OStream.read() before EOF · Issue #120 · gitpython-developers/gitdb

X Title: Empty read from gitdb.OStream.read() before EOF · Issue #120 · gitpython-developers/gitdb

Description: I have code that relies on reading an object from a gitdb stream. To do this I used with a standard .read() loop (like with io.RawIOBase): stream = db.stream(bytes.fromhex(sha)) while chunk := stream.read(4096): yield chunk The behaviour...

Open Graph Description: I have code that relies on reading an object from a gitdb stream. To do this I used with a standard .read() loop (like with io.RawIOBase): stream = db.stream(bytes.fromhex(sha)) while chunk := stre...

X Description: I have code that relies on reading an object from a gitdb stream. To do this I used with a standard .read() loop (like with io.RawIOBase): stream = db.stream(bytes.fromhex(sha)) while chunk := stre...

Opengraph URL: https://github.com/gitpython-developers/gitdb/issues/120

X: @github

direct link

Domain: togithub.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Empty read from gitdb.OStream.read() before EOF","articleBody":"I have code that relies on reading an object from a gitdb stream.\n\nTo do this I used with a standard `.read()` loop (like with [io.RawIOBase](https://docs.python.org/3/library/io.html#io.RawIOBase)):\n\n```python\nstream = db.stream(bytes.fromhex(sha))\nwhile chunk := stream.read(4096):\n    yield chunk\n```\n\nThe behaviour I expected to see (from the duck-type with RawIOBase) is to only see `b''` at EOF:\n\n\u003e If 0 bytes are returned, and size was not 0, this indicates end of file. \n\nHowever `stream.read(4096)` can return empty chunks even before the end of the stream, so the loop exits early.\n\nFor the file where I saw this first, it is sensitive to the `size` parameter - it apparently occurs for `0 \u003c size \u003c= 4096`.\n\nLooking at the code there is a condition to repeat a read if we got insufficient bytes:\n\nhttps://github.com/gitpython-developers/gitdb/blob/f36c0cc42ea2f529291e441073f74e920988d4d2/gitdb/stream.py#L316-L317\n\nHowever the leading `if dcompdat and ` means that the condition doesn't apply if zero bytes were read. Removing this part of the condition addresses the issue (but I understand from the comment that this is in order to support `compressed_bytes_read()`).","author":{"url":"https://github.com/lordmauve","@type":"Person","name":"lordmauve"},"datePublished":"2025-04-16T10:35:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/120/gitdb/issues/120"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4c6ee7e1-74bb-f3de-e295-5f93240de9c1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAF26:3DE9D:B4426:F129E:6969403C
html-safe-nonce8945d4db23dab07c5adea64711a6ca0ce49fce09a73d9f051700160df56388e5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjI2OjNERTlEOkI0NDI2OkYxMjlFOjY5Njk0MDNDIiwidmlzaXRvcl9pZCI6IjE4MDI3MTc3ODU4NzU4OTAyMzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0e22b9e9e58b6e9f3e09d3be5ed799d116ea505b96cf31a76d1436c1fb959f95
hovercard-subject-tagissue:2999218306
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/gitdb/120/issue_layout
twitter:imagehttps://opengraph.githubassets.com/79f6d87f930bb8f908f8a26c95555a0b819fa6cacea7e23cec4b27a3a734e87d/gitpython-developers/gitdb/issues/120
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/79f6d87f930bb8f908f8a26c95555a0b819fa6cacea7e23cec4b27a3a734e87d/gitpython-developers/gitdb/issues/120
og:image:altI have code that relies on reading an object from a gitdb stream. To do this I used with a standard .read() loop (like with io.RawIOBase): stream = db.stream(bytes.fromhex(sha)) while chunk := stre...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelordmauve
hostnamegithub.com
expected-hostnamegithub.com
None54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d
turbo-cache-controlno-preview
go-importgithub.com/gitpython-developers/gitdb git https://github.com/gitpython-developers/gitdb.git
octolytics-dimension-user_id503709
octolytics-dimension-user_logingitpython-developers
octolytics-dimension-repository_id1126093
octolytics-dimension-repository_nwogitpython-developers/gitdb
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1126093
octolytics-dimension-repository_network_root_nwogitpython-developers/gitdb
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
released69ac0477df0f87da03b8b06cebd187012d7a930
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://togithub.com/gitpython-developers/gitdb/issues/120#start-of-content
https://togithub.com/
Sign in https://togithub.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2Fgitdb%2Fissues%2F120
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://togithub.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgitpython-developers%2Fgitdb%2Fissues%2F120
Sign up https://togithub.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=gitpython-developers%2Fgitdb
Reloadhttps://togithub.com/gitpython-developers/gitdb/issues/120
Reloadhttps://togithub.com/gitpython-developers/gitdb/issues/120
Reloadhttps://togithub.com/gitpython-developers/gitdb/issues/120
gitpython-developers https://togithub.com/gitpython-developers
gitdbhttps://togithub.com/gitpython-developers/gitdb
Notifications https://togithub.com/login?return_to=%2Fgitpython-developers%2Fgitdb
Fork 68 https://togithub.com/login?return_to=%2Fgitpython-developers%2Fgitdb
Star 225 https://togithub.com/login?return_to=%2Fgitpython-developers%2Fgitdb
Code https://togithub.com/gitpython-developers/gitdb
Issues 8 https://togithub.com/gitpython-developers/gitdb/issues
Pull requests 0 https://togithub.com/gitpython-developers/gitdb/pulls
Discussions https://togithub.com/gitpython-developers/gitdb/discussions
Actions https://togithub.com/gitpython-developers/gitdb/actions
Security Uh oh! There was an error while loading. Please reload this page. https://togithub.com/gitpython-developers/gitdb/security
Please reload this pagehttps://togithub.com/gitpython-developers/gitdb/issues/120
Insights https://togithub.com/gitpython-developers/gitdb/pulse
Code https://togithub.com/gitpython-developers/gitdb
Issues https://togithub.com/gitpython-developers/gitdb/issues
Pull requests https://togithub.com/gitpython-developers/gitdb/pulls
Discussions https://togithub.com/gitpython-developers/gitdb/discussions
Actions https://togithub.com/gitpython-developers/gitdb/actions
Security https://togithub.com/gitpython-developers/gitdb/security
Insights https://togithub.com/gitpython-developers/gitdb/pulse
New issuehttps://togithub.com/login?return_to=https://github.com/gitpython-developers/gitdb/issues/120
New issuehttps://togithub.com/login?return_to=https://github.com/gitpython-developers/gitdb/issues/120
Empty read from gitdb.OStream.read() before EOFhttps://togithub.com/gitpython-developers/gitdb/issues/120#top
acknowledgedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22acknowledged%22
help wantedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/lordmauve
https://github.com/lordmauve
lordmauvehttps://github.com/lordmauve
on Apr 16, 2025https://github.com/gitpython-developers/gitdb/issues/120#issue-2999218306
io.RawIOBasehttps://docs.python.org/3/library/io.html#io.RawIOBase
gitdb/gitdb/stream.pyhttps://github.com/gitpython-developers/gitdb/blob/f36c0cc42ea2f529291e441073f74e920988d4d2/gitdb/stream.py#L316-L317
f36c0cchttps://togithub.com/gitpython-developers/gitdb/commit/f36c0cc42ea2f529291e441073f74e920988d4d2
acknowledgedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22acknowledged%22
help wantedhttps://github.com/gitpython-developers/gitdb/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.