Skip to content

BlobWriter does not implement closed property #903

@kalaracey

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.

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