Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

BlobWriter does not implement closed property #903

Closed

Description

@kalaracey

Environment details

  • OS type and version: Mac OS X 12.6
  • Python version: python --version: 3.9.0
  • pip version: pip --version: 22.2.0
  • google-cloud-storage version: pip show google-cloud-storage: 2.6.0

Steps to reproduce

Run the code example below, substituting a real bucket for some-bucket.

Code example

from google.cloud import storage

client = storage.Client()
bucket = storage.Bucket.from_string("gs://some-bucket", client=client)
blob = bucket.blob('deleteme')
stream = blob.open(mode='w', ignore_flush=True)
stream.write("foobarbaz")
stream.close()
print(stream.closed) # --> False.

stream.closed should return True after stream.close() is called. I think it's probably returning False because BlobWriter is not calling super.close() and does not override IOBase.closed.

BlobReader may have a similar problem, I haven't checked.

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Nov 14, 2022
  2. andrewsg commented on Nov 14, 2022

    @andrewsg
    Contributor

    Thank you for reporting this!

  3. andrewsg commented on Dec 6, 2022

    @andrewsg
    Contributor

    This is going out in today's release. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the googleapis/python-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions